Maybe you could try to explore why is this crashing? I don't like to change the plugin interface to provide errors, we could end up with code checking if plugins are wrong all over the place.<div><br></div><div>Aleix<br>
<br><div class="gmail_quote">On Sat, Dec 18, 2010 at 9:53 PM, Dmitry Risenberg <span dir="ltr"><<a href="mailto:dmitry.risenberg@gmail.com">dmitry.risenberg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> virtual bool unloadPlugin( const QString & plugin ) = 0;<br>
><br>
> from a delayed slot, i.e. in the ctor of the plugin do:<br>
><br>
> if (!gitInstalled) {<br>
>  QMetaObject::invokeMethod(this, "unloadDelayed");<br>
>  return;<br>
> }<br>
><br>
> then:<br>
><br>
> private slots:<br>
>  void unloadDelayed() {<br>
>    KDevelop::ICore::self()->pluginController()->unloadPlugin("git");<br>
>    // or whatever the name is here...<br>
>  }<br>
<br>
</div>Tried this - it did not work, because once a plugin object is created<br>
in PluginController::loadPluginInternal, it is passed upwards, in this<br>
case - to ProjecPrivatet::loadVersionControlPlugin. If the plugin is<br>
unloaded in the process, then the passed object is in fact invalid,<br>
and calling its methods leads to a crash. In my version the created<br>
plugin object gets discarded if it has an error - the anticipated<br>
design was to throw an exception from the constructor, which is not<br>
safe in this context, so there are these hasError/errorDescription<br>
methods.<br>
<br>
Here's the actual patch I tried: <a href="http://pastebin.com/vDd9cpiB" target="_blank">http://pastebin.com/vDd9cpiB</a>.<br>
<br>
--<br>
Dmitry Risenberg<br>
<font color="#888888"><br>
--<br>
KDevelop-devel mailing list<br>
<a href="mailto:KDevelop-devel@kdevelop.org">KDevelop-devel@kdevelop.org</a><br>
<a href="https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel" target="_blank">https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel</a><br>
</font></blockquote></div><br></div>