diff --git a/src/browser.hxx b/src/browser.hxx index e2348c0..70dc66d 100644 --- a/src/browser.hxx +++ b/src/browser.hxx @@ -241,6 +241,8 @@ class Browser: public QMainWindow, protected Ui::Browser { ~Browser() { TRC; QWebSettings::clearIconDatabase(); + qbrowserlib::Settings::purge(); // free singleton + qbrowserlib::ErrorLog::purge(); // free singleton } //! Whitelisting diff --git a/src/qbrowserlib/errorlog.hxx b/src/qbrowserlib/errorlog.hxx index f93aed5..eb9eb9b 100644 --- a/src/qbrowserlib/errorlog.hxx +++ b/src/qbrowserlib/errorlog.hxx @@ -26,8 +26,11 @@ namespace qbrowserlib { public: //! Singleton static ErrorLog& instance(QWidget* p=0) { - static ErrorLog _instance(p); - return _instance; + static ErrorLog* _instance(new ErrorLog(p)); + return *_instance; + } + static void purge() { + delete &instance(); } private: // singleton ErrorLog(const ErrorLog&); diff --git a/src/qbrowserlib/settings.hxx b/src/qbrowserlib/settings.hxx index 2283835..8a08331 100644 --- a/src/qbrowserlib/settings.hxx +++ b/src/qbrowserlib/settings.hxx @@ -39,8 +39,13 @@ namespace qbrowserlib { //! Singleton static Settings& instance(MimeTypes mimetypes=MimeTypes(), QWidget* p=0, QSettings* settings=0, bool autoWrite=true) { - static Settings _instance(mimetypes, p, settings, autoWrite); - return _instance; + static Settings* _instance + (new Settings(mimetypes, p, settings, autoWrite)); + return *_instance; + } + + static void purge() { + delete &instance(); } private: