[KPhotoAlbum] [PATCH 1/8] Cleanup: Unnecessary code removal and comment movement

Michael Witten mfwitten at MIT.EDU
Sun Sep 21 08:46:37 BST 2008


The statement:

    Settings::SettingsData::instance()

doesn't actually create the instance; it must have
already been created by somewhere calling:

    Settings::SettingsData::setup( const QString& imageDirectory )

which is currently done as follows:

    MainWindow::Window::Window( QWidget* parent )

        MainWindow::Window::load()

            Settings::SettingsData::setup(...)

Frankly, the singleton SettingsData::instance() should
be established in main().

Signed-off-by: Michael Witten <mfwitten at mit.edu>
---
 MainWindow/Window.cpp |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/MainWindow/Window.cpp b/MainWindow/Window.cpp
index ab77245..be4bb69 100644
--- a/MainWindow/Window.cpp
+++ b/MainWindow/Window.cpp
@@ -140,10 +140,6 @@ MainWindow::Window::Window( QWidget* parent )
         exit(0);
     SplashScreen::instance()->message( i18n("Loading Main Window") );
 
-    // To avoid a race conditions where both the image loader thread creates an instance of
-    // Options, and where the main thread crates an instance, we better get it created now.
-    Settings::SettingsData::instance();
-
     QWidget* top = new QWidget( this );
     QVBoxLayout* lay = new QVBoxLayout( top );
     setCentralWidget( top );
@@ -951,6 +947,8 @@ bool MainWindow::Window::load()
     if (configFile.startsWith( QString::fromLatin1( "~" ) ) )
         configFile = QDir::home().path() + QString::fromLatin1( "/" ) + configFile.mid(1);
 
+    // To avoid a race conditions where both the image loader thread creates an instance of
+    // Options, and where the main thread crates an instance, we better get it created now.
     Settings::SettingsData::setup( QFileInfo( configFile ).absolutePath() );
 
     if ( Settings::SettingsData::instance()->showSplashScreen() ) {
-- 
1.6.0.2.296.gfe33b




More information about the Kphotoalbum mailing list