Fixed seg fault on logout.
[situare] / src / ui / mainwindow.cpp
index a8f58ed..8a0ea5a 100644 (file)
@@ -77,8 +77,7 @@ MainWindow::MainWindow(QWidget *parent)
       m_crosshair(0),
       m_fullScreenButton(0),
       m_indicatorButtonPanel(0),
-      m_mapScale(0),
-      m_updateLocationController(0)
+      m_mapScale(0)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -114,6 +113,12 @@ MainWindow::MainWindow(QWidget *parent)
 #ifdef Q_WS_MAEMO_5
     setAttribute(Qt::WA_Maemo5StackedWindow);
 #endif
+
+    m_updateLocationController = new UpdateLocation(this);
+
+    connect(this, SIGNAL(updateWasSuccessful()), m_updateLocationController, SLOT(clear()));
+    connect(m_updateLocationController, SIGNAL(locationUpdate(QString,bool)),
+            this, SIGNAL(locationUpdate(QString,bool)));
 }
 
 MainWindow::~MainWindow()
@@ -282,7 +287,7 @@ void MainWindow::buildLocationSearchPanel()
 
 void MainWindow::buildLoginDialog(QWebView *browser)
 {
-    qWarning() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__;
 
     if (!m_loginDialog) {
         m_loginDialog = new QDialog(this);
@@ -521,7 +526,7 @@ void MainWindow::createMenus()
 
 void MainWindow::destroyLoginDialog()
 {
-    qWarning() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__;
 
     if (m_loginDialog) {
         m_loginDialog->hide();
@@ -824,16 +829,6 @@ void MainWindow::showUpdateLocationDialog()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    if (!m_updateLocationController) {
-        m_updateLocationController = new UpdateLocation(this);
-        if (!m_updateLocationController)
-            return;
-        else
-            connect(this, SIGNAL(updateWasSuccessful()), m_updateLocationController, SLOT(clear()));
-            connect(m_updateLocationController, SIGNAL(locationUpdate(QString,bool)),
-                    this, SIGNAL(locationUpdate(QString,bool)));
-    }
-
     UpdateLocationDialog *updateLocationDialog
             = new UpdateLocationDialog(m_updateLocationController, this);
 
@@ -847,7 +842,7 @@ void MainWindow::showUpdateLocationDialog()
 
 void MainWindow::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
 {
-    qWarning() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__;
 
     Q_UNUSED(errors)
     reply->ignoreSslErrors();