Commit eba018e1 authored by David Faure's avatar David Faure
Browse files

Hard to not make it a singleton, mainwindows are created in many places.

But fix konqviewtest by adding an explicit KonqClosedWindowsManager::destroy()
parent e23337ba
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
int m_maxNumClosedItems; int m_maxNumClosedItems;
}; };
Q_GLOBAL_STATIC(KonqClosedWindowsManagerPrivate, myKonqClosedWindowsManagerPrivate) static KonqClosedWindowsManagerPrivate *myKonqClosedWindowsManagerPrivate = nullptr;
KonqClosedWindowsManager::KonqClosedWindowsManager() KonqClosedWindowsManager::KonqClosedWindowsManager()
{ {
...@@ -88,9 +88,18 @@ KConfig *KonqClosedWindowsManager::memoryStore() ...@@ -88,9 +88,18 @@ KConfig *KonqClosedWindowsManager::memoryStore()
KonqClosedWindowsManager *KonqClosedWindowsManager::self() KonqClosedWindowsManager *KonqClosedWindowsManager::self()
{ {
if (!myKonqClosedWindowsManagerPrivate) {
myKonqClosedWindowsManagerPrivate = new KonqClosedWindowsManagerPrivate;
}
return &myKonqClosedWindowsManagerPrivate->instance; return &myKonqClosedWindowsManagerPrivate->instance;
} }
void KonqClosedWindowsManager::destroy()
{
delete myKonqClosedWindowsManagerPrivate;
myKonqClosedWindowsManagerPrivate = nullptr;
}
void KonqClosedWindowsManager::addClosedWindowItem(KonqUndoManager void KonqClosedWindowsManager::addClosedWindowItem(KonqUndoManager
*real_sender, KonqClosedWindowItem *closedWindowItem, bool propagate) *real_sender, KonqClosedWindowItem *closedWindowItem, bool propagate)
{ {
......
...@@ -50,6 +50,7 @@ public: ...@@ -50,6 +50,7 @@ public:
~KonqClosedWindowsManager() override; ~KonqClosedWindowsManager() override;
static KonqClosedWindowsManager *self(); static KonqClosedWindowsManager *self();
static void destroy();
const QList<KonqClosedWindowItem *> &closedWindowItemList(); const QList<KonqClosedWindowItem *> &closedWindowItemList();
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "konqview.h" #include "konqview.h"
#include "konqsettingsxt.h" #include "konqsettingsxt.h"
#include "konqurl.h" #include "konqurl.h"
#include "konqclosedwindowsmanager.h"
#include <KAboutData> #include <KAboutData>
#include <KCrash> #include <KCrash>
...@@ -302,5 +303,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) ...@@ -302,5 +303,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
KonqSessionManager::self()->disableAutosave(); KonqSessionManager::self()->disableAutosave();
KonqSessionManager::self()->deleteOwnedSessions(); KonqSessionManager::self()->deleteOwnedSessions();
KonqClosedWindowsManager::destroy();
return ret; return ret;
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment