[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevelop/debuggers
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2009-07-22 14:16:10
Message-ID: 1248272170.788540.28274.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1001037 by apaku:

Properly unload toolviews when the plugin is unloaded.
BUG:178445

 M  +18 -9     gdb/debuggerplugin.cpp  
 M  +7 -0      gdb/debuggerplugin.h  
 M  +8 -3      valgrind/valgrindplugin.cpp  
 M  +3 -0      valgrind/valgrindplugin.h  


--- trunk/KDE/kdevelop/debuggers/gdb/debuggerplugin.cpp #1001036:1001037
@@ -139,23 +139,25 @@
 
     setXMLFile("kdevgdbui.rc");
 
+    disassemblefactory = new DebuggerToolFactory<DisassembleWidget>(
+    this, "org.kdevelop.debugger.DisassemblerView", Qt::BottomDockWidgetArea);
+
+    gdbfactory = new DebuggerToolFactory<GDBOutputWidget>(
+    this, "org.kdevelop.debugger.ConsoleView",Qt::BottomDockWidgetArea);
+    viewerfactory = new DebuggerToolFactory<ViewerWidget>(
+    this, "org.kdevelop.debugger.VariousViews", Qt::BottomDockWidgetArea);
+    
     core()->uiController()->addToolView(
         i18n("Disassemble"),
-        new DebuggerToolFactory<DisassembleWidget>(
-            this, "org.kdevelop.debugger.DisassemblerView",
-            Qt::BottomDockWidgetArea));
+        disassemblefactory);
 
     core()->uiController()->addToolView(
         i18n("GDB"),
-        new DebuggerToolFactory<GDBOutputWidget>(
-            this, "org.kdevelop.debugger.ConsoleView",
-            Qt::BottomDockWidgetArea));
+        gdbfactory);
 
     core()->uiController()->addToolView(
         i18n("Debug views"),
-        new DebuggerToolFactory<ViewerWidget>(
-            this, "org.kdevelop.debugger.VariousViews",
-            Qt::BottomDockWidgetArea));
+        viewerfactory);
 
     setupActions();
 
@@ -176,6 +178,13 @@
 //              procLineMaker,         SLOT(slotReceivedStdout(const QByteArray&)));
 }
 
+void CppDebuggerPlugin::unload()
+{
+    core()->uiController()->removeToolView(disassemblefactory);
+    core()->uiController()->removeToolView(gdbfactory);
+    core()->uiController()->removeToolView(viewerfactory);
+}
+
 void CppDebuggerPlugin::setupActions()
 {
     KActionCollection* ac = actionCollection();
--- trunk/KDE/kdevelop/debuggers/gdb/debuggerplugin.h #1001036:1001037
@@ -59,6 +59,7 @@
 class GDBOutputWidget;
 class ViewerWidget;
 class DebugSession;
+template<typename T> class DebuggerToolFactory;
 
 class CppDebuggerPlugin : public KDevelop::IPlugin, public KDevelop::IStatus
 {
@@ -71,6 +72,8 @@
     CppDebuggerPlugin( QObject *parent, const QVariantList & = QVariantList() );
     ~CppDebuggerPlugin();
 
+    virtual void unload();
+    
     virtual KDevelop::ContextMenuExtension contextMenuExtension( KDevelop::Context* );
     
     DebugSession *createSession();
@@ -147,6 +150,10 @@
     KConfigGroup m_config;
 
     DebugSession* m_session;
+    DebuggerToolFactory< DisassembleWidget >* disassemblefactory;
+    DebuggerToolFactory< GDBOutputWidget >* gdbfactory;
+    DebuggerToolFactory< ViewerWidget >* viewerfactory;
+    
 };
 
 }
--- trunk/KDE/kdevelop/debuggers/valgrind/valgrindplugin.cpp #1001036:1001037
@@ -92,13 +92,13 @@
 };
 
 ValgrindPlugin::ValgrindPlugin( QObject *parent, const QVariantList& )
-    : IPlugin( ValgrindFactory::componentData(), parent)
+    : IPlugin( ValgrindFactory::componentData(), parent), m_factory( new ValgrindWidgetFactory(this) )
 {
     kDebug() << "setting valgrind rc file";
     setXMLFile( "kdevvalgrind.rc" );
-
-    core()->uiController()->addToolView(i18n("Valgrind"), new ValgrindWidgetFactory(this));
     
+    core()->uiController()->addToolView(i18n("Valgrind"), m_factory);
+    
     // Initialize actions for the laucnh modes
     KAction* act = actionCollection()->addAction("valgrind_memcheck", this, SLOT(runMemCheck()) );
     act->setText( i18n("Memory Check" ) );
@@ -137,6 +137,11 @@
     type->addLauncher( launcher );
 }
 
+void ValgrindPlugin::unload()
+{
+    core()->uiController()->removeToolView( m_factory );
+}
+
 ValgrindPlugin::~ValgrindPlugin()
 {
 }
--- trunk/KDE/kdevelop/debuggers/valgrind/valgrindplugin.h #1001036:1001037
@@ -49,6 +49,8 @@
     ValgrindPlugin( QObject *parent, const QVariantList & = QVariantList() );
     ~ValgrindPlugin();
 
+    virtual void unload();
+    
 signals:
 
     void newModel(ValgrindModel* model);
@@ -63,6 +65,7 @@
 private:
     QString m_lastExec, m_lastParams, m_lastValExec, m_lastValParams,
         m_lastCtExec, m_lastCtParams, m_lastKcExec;
+    class ValgrindWidgetFactory* m_factory;
 };
 
 #endif // VALGRINDPLUGIN_H
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic