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() {
TRC;
QWebSettings::clearIconDatabase();
qbrowserlib::Settings::purge(); // free singleton
qbrowserlib::ErrorLog::purge(); // free singleton
}
//! Whitelisting

@ -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&);

@ -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:

Loading…
Cancel
Save