remove singletons when qt is still initialized; refs #170

master
Marc Wäckerlin 12 years ago
parent 0315e93444
commit c7d6f5ac18
  1. 2
      src/browser.hxx
  2. 7
      src/qbrowserlib/errorlog.hxx
  3. 9
      src/qbrowserlib/settings.hxx

@ -241,6 +241,8 @@ class Browser: public QMainWindow, protected Ui::Browser {
~Browser() { ~Browser() {
TRC; TRC;
QWebSettings::clearIconDatabase(); QWebSettings::clearIconDatabase();
qbrowserlib::Settings::purge(); // free singleton
qbrowserlib::ErrorLog::purge(); // free singleton
} }
//! Whitelisting //! Whitelisting

@ -26,8 +26,11 @@ namespace qbrowserlib {
public: public:
//! Singleton //! Singleton
static ErrorLog& instance(QWidget* p=0) { static ErrorLog& instance(QWidget* p=0) {
static ErrorLog _instance(p); static ErrorLog* _instance(new ErrorLog(p));
return _instance; return *_instance;
}
static void purge() {
delete &instance();
} }
private: // singleton private: // singleton
ErrorLog(const ErrorLog&); ErrorLog(const ErrorLog&);

@ -39,8 +39,13 @@ namespace qbrowserlib {
//! Singleton //! Singleton
static Settings& instance(MimeTypes mimetypes=MimeTypes(), QWidget* p=0, static Settings& instance(MimeTypes mimetypes=MimeTypes(), QWidget* p=0,
QSettings* settings=0, bool autoWrite=true) { QSettings* settings=0, bool autoWrite=true) {
static Settings _instance(mimetypes, p, settings, autoWrite); static Settings* _instance
return _instance; (new Settings(mimetypes, p, settings, autoWrite));
return *_instance;
}
static void purge() {
delete &instance();
} }
private: private:

Loading…
Cancel
Save