Bug 118608

Summary: Pulse Extension doesn't remove menu entry when unloaded
Product: [Applications] kst Reporter: D. V. Wiebe <dvw>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description D. V. Wiebe 2005-12-19 01:00:33 UTC
Version:           1.2.0_dr1 (using KDE 3.4.2, compiled sources)
Compiler:          gcc version 3.3.6
OS:                Linux (i686) release 2.6.13

When the Pulse Extension is enabled, it adds an entry to the Tools menu called "Pulse Generator".  When the Pulse Extension is subsequently disabled, this menu entry is not removed.  Subsequent re-enablings of the Pulse Extension add addition "Pulse Generator" entries to the Tools menu.

Steps to reproduce:

1) Settings -> Extensions...
   Enable "Pulse Extension"

   There is now an entry in the Tools menu called "Pulse Generator".

2) Settings -> Extensions...
   Disable "Pulse Extension"

   The "Pulse Generator" item in the Tools menu remains.

3) Settings -> Extensions...
   Enable "Pulse Extension"


Result:

There are now two entries in the Tools menu called "Pulse Generator".

Expected Result:

The "Pulse Generator" entry in the Tools menu should be removed when the Pulse Extension is disabled, and should only appear once when the Pulse Extension is enabled.
Comment 1 D. V. Wiebe 2005-12-19 01:05:32 UTC
The same behaviour is seen with the two entries in the Tools menu ("Show Javascript Console" and "Clear Javascript Interpreter") created by the Javascript Extension.

The ELOG Extension appears to clean itself up properly.
Comment 2 George Staikos 2005-12-19 04:25:44 UTC
SVN commit 489553 by staikos:

properly unload extensions, since the crash is now fixed
BUG: 118608


 M  +4 -2      js/js.cpp  
 M  +4 -0      pulse/pulse.cpp  


--- trunk/extragear/graphics/kst/kst/extensions/js/js.cpp #489552:489553
@@ -138,8 +138,10 @@
   delete _iface;
   _iface = 0L;
   destroyRegistry();
-  // crash
-  //app()->guiFactory()->removeClient(this);
+  KstApp *app = this->app();
+  if (app && app->guiFactory()) {
+    app->guiFactory()->removeClient(this);
+  }
 }
 
 
--- trunk/extragear/graphics/kst/kst/extensions/pulse/pulse.cpp #489552:489553
@@ -51,6 +51,10 @@
   for (KstGVectorList::Iterator i = gvl.begin(); i != gvl.end(); ++i) {
     (*i)->setFrequency(0);
   }
+  KstApp *app = this->app();
+  if (app && app->guiFactory()) {
+    app->guiFactory()->removeClient(this);
+  }
 }