aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2011-02-21 23:46:03 +0000
committerGravatar Szymon Tomasz Stefanek2011-02-21 23:46:03 +0000
commit3aa8783cf40bfb9e5759cee86bd734df645b153e (patch)
tree695ee7b834045ccfb5b0b69fc21678a768a4d0a2
parentUpdate the po files (diff)
downloadKVIrc-3aa8783cf40bfb9e5759cee86bd734df645b153e.tar.gz
KVIrc-3aa8783cf40bfb9e5759cee86bd734df645b153e.tar.bz2
KVIrc-3aa8783cf40bfb9e5759cee86bd734df645b153e.zip
More memory leak hunting
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5501 17fca916-40b9-46aa-a4ea-0a15b648b75c
-rw-r--r--src/kvirc/ui/KviMainWindow.cpp8
-rw-r--r--src/modules/objects/KvsObject_window.cpp5
-rw-r--r--src/modules/objects/KvsObject_window.h33
3 files changed, 27 insertions, 19 deletions
diff --git a/src/kvirc/ui/KviMainWindow.cpp b/src/kvirc/ui/KviMainWindow.cpp
index 6cab4d8fa..ff64f519b 100644
--- a/src/kvirc/ui/KviMainWindow.cpp
+++ b/src/kvirc/ui/KviMainWindow.cpp
@@ -182,7 +182,10 @@ KviMainWindow::~KviMainWindow()
saveToolBarPositions();
saveModuleExtensionToolBars();
-
+#if 0
+ // Pragma: This shouldn't be needed any more
+ // The objects module must call closeWindow() internally.
+ //
// close all the KviKvsScriptWindowWindow to avoid a race condition
// where such a window will be free'd two times:
// the first in the frameDestructorCallback (deleted as an object instance)
@@ -190,8 +193,9 @@ KviMainWindow::~KviMainWindow()
for(KviWindow * wnd = m_pWinList->first();wnd;wnd = m_pWinList->next())
{
if(wnd->inherits("KviKvsScriptWindowWindow"))
- closeWindow(wnd);
+ closeWindow(wnd);
}
+#endif
// Call the frame destructor callback AFTER saving the toolbar positions
// This is because the destructor callback kills alls the KVS objects
diff --git a/src/modules/objects/KvsObject_window.cpp b/src/modules/objects/KvsObject_window.cpp
index 603c1bd04..f3b741481 100644
--- a/src/modules/objects/KvsObject_window.cpp
+++ b/src/modules/objects/KvsObject_window.cpp
@@ -113,12 +113,13 @@ KVSO_END_CONSTRUCTOR(KvsObject_window)
KVSO_BEGIN_DESTRUCTOR(KvsObject_window)
-
+ if(widget())
+ g_pMainWindow->closeWindow(((KviKvsScriptWindowWindow *)widget()));
KVSO_END_CONSTRUCTOR(KvsObject_window)
bool KvsObject_window::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *)
{
- KviWindow * w = new KviKvsScriptWindowWindow(pContext->window()->frame(),getName());
+ KviKvsScriptWindowWindow * w = new KviKvsScriptWindowWindow(pContext->window()->frame(),getName());
setObject(w);
pContext->window()->frame()->addWindow(w,false);
w->minimize(); // must be minimized before children are added, otherwise the focus handling goes nuts...
diff --git a/src/modules/objects/KvsObject_window.h b/src/modules/objects/KvsObject_window.h
index 63468f434..b074f1e32 100644
--- a/src/modules/objects/KvsObject_window.h
+++ b/src/modules/objects/KvsObject_window.h
@@ -28,21 +28,6 @@
#include "KviWindow.h"
#include "object_macros.h"
-class KvsObject_window : public KvsObject_widget
-{
-public:
- KVSO_DECLARE_OBJECT(KvsObject_window)
-public:
- QWidget * widget() { return (QWidget *)object(); };
-
-protected:
- virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams);
-
- bool setWindowTitle(KviKvsObjectFunctionCall *c);
- bool setIcon(KviKvsObjectFunctionCall *c);
- bool setCentralWidget(KviKvsObjectFunctionCall *c);
-
-};
class KviKvsScriptWindowWindow : public KviWindow
@@ -70,4 +55,22 @@ protected slots:
void centralWidgetDestroyed();
};
+
+class KvsObject_window : public KvsObject_widget
+{
+public:
+ KVSO_DECLARE_OBJECT(KvsObject_window)
+public:
+ QWidget * widget() { return (QWidget *)object(); };
+
+protected:
+ virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams);
+
+ bool setWindowTitle(KviKvsObjectFunctionCall *c);
+ bool setIcon(KviKvsObjectFunctionCall *c);
+ bool setCentralWidget(KviKvsObjectFunctionCall *c);
+
+};
+
+
#endif // !_CLASS_WINDOW_H_