[Okular-devel] [Bug 261538] KXMLGUIClient memory corruption warning

Albert Astals Cid tsdgeos at terra.es
Sun Jan 23 03:05:05 CET 2011


https://bugs.kde.org/show_bug.cgi?id=261538


Albert Astals Cid <tsdgeos at terra.es> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |faure at kde.org




--- Comment #2 from Albert Astals Cid <tsdgeos terra es>  2011-01-23 03:05:03 ---
Adding David as it is a warning he introduced recently.

David, i can "fix" this by doing

Index: shell/shell.cpp
===================================================================
--- shell/shell.cpp     (revision 1214938)
+++ shell/shell.cpp     (working copy)
@@ -42,6 +42,7 @@
 #include <ktoggleaction.h>
 #include <ktogglefullscreenaction.h>
 #include <kactioncollection.h>
+#include <kxmlguifactory.h>

 // local includes
 #include "kdocumentviewer.h"
@@ -118,8 +119,12 @@

 Shell::~Shell()
 {
-    if ( m_part ) writeSettings();
-    delete m_part;
+    if ( m_part )
+    {
+        writeSettings();
+        factory()->removeClient( m_part );
+        delete m_part;
+    }
     if ( m_args )
         m_args->clear();
 }

But i feel it is somehow weird i have to call 
   factory()->removeClient( m_part );
when i never called addClient().

Is the warning too aggressive? Or do we really ahve to call removeClient before
deleting our parts?

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Okular-devel mailing list