Inter plugin communication

Roberto Raggi roberto at
Sat May 21 13:00:06 UTC 2005

Hi Jens!

Scrive Jens Herden <jens at>:

> What happens if the plugin 1 was not loaded? Is it still save to call this?
> setInstance() was never executed what will I get from MyInterface
> *instance() ?

it's not possible! KDevelop loads all the plugins and then it emits the signal
coreInitialized(). instance() == 0x0 means the plugin is not available (i.e.
disabled, not installed, and so on..)

of course it's not safe to call the method ::instance() from a constructor(only
setInstance() should be called from a constructor).

class MyPlugin: public KDevPlugin, ...
Q_OBJECT && friends

private slots:
   void pluginPolished();

  setInstance(this); // if another plugin needs to call me

  connect(core(), SIGNAL(coreInitialized()), //if I need to call another plugin
     this, SLOT(pluginPolished()));

void MyPlugin::pluginPolished()
  connect(Plugin2::instance()->objectCast(), ....);

ciao robe

This message was sent using IMP, the Internet Messaging Program.

More information about the KDevelop-devel mailing list