[KDevPlatform/1.2] 5774a52: Check that git is installed when loading Git Suppo

Dmitry Risenberg dmitry.risenberg at gmail.com
Sat Dec 18 20:53:03 UTC 2010


> virtual bool unloadPlugin( const QString & plugin ) = 0;
>
> from a delayed slot, i.e. in the ctor of the plugin do:
>
> if (!gitInstalled) {
>  QMetaObject::invokeMethod(this, "unloadDelayed");
>  return;
> }
>
> then:
>
> private slots:
>  void unloadDelayed() {
>    KDevelop::ICore::self()->pluginController()->unloadPlugin("git");
>    // or whatever the name is here...
>  }

Tried this - it did not work, because once a plugin object is created
in PluginController::loadPluginInternal, it is passed upwards, in this
case - to ProjecPrivatet::loadVersionControlPlugin. If the plugin is
unloaded in the process, then the passed object is in fact invalid,
and calling its methods leads to a crash. In my version the created
plugin object gets discarded if it has an error - the anticipated
design was to throw an exception from the constructor, which is not
safe in this context, so there are these hasError/errorDescription
methods.

Here's the actual patch I tried: http://pastebin.com/vDd9cpiB.

-- 
Dmitry Risenberg




More information about the KDevelop-devel mailing list