From cce47a77c3c7dd08460775073f186c83426a6f69 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Fri, 7 Jun 2013 16:59:18 +0400 Subject: [PATCH] Don't delete latest release reply directly in slot --- mainwindow.cc | 11 +++++++---- mainwindow.hh | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 98739d7f..4e00aa80 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -76,6 +76,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): dictNetMgr( this ), wordFinder( this ), newReleaseCheckTimer( this ), + latestReleaseReply( 0 ), wordListSelChanged( false ) , wasMaximized( false ) , blockUpdateWindowTitle( false ) @@ -2547,7 +2548,8 @@ void MainWindow::prepareNewReleaseChecks() void MainWindow::checkForNewRelease() { - latestReleaseReply.reset(); + if( latestReleaseReply ) + latestReleaseReply->deleteLater(); QNetworkRequest req( QUrl( "http://goldendict.org/latest_release.php?current=" @@ -2568,13 +2570,13 @@ void MainWindow::checkForNewRelease() latestReleaseReply = articleNetMgr.get( req ); - connect( latestReleaseReply.get(), SIGNAL( finished() ), + connect( latestReleaseReply, SIGNAL( finished() ), this, SLOT( latestReleaseReplyReady() ), Qt::QueuedConnection ); } void MainWindow::latestReleaseReplyReady() { - if ( !latestReleaseReply.get() ) + if ( !latestReleaseReply ) return; // Some stray signal bool success = false; @@ -2594,7 +2596,8 @@ void MainWindow::latestReleaseReplyReady() } } - latestReleaseReply.reset(); + latestReleaseReply->deleteLater(); + latestReleaseReply = 0; if ( !success ) { diff --git a/mainwindow.hh b/mainwindow.hh index 9f743aad..034ff0cd 100644 --- a/mainwindow.hh +++ b/mainwindow.hh @@ -145,7 +145,7 @@ private: QTimer newReleaseCheckTimer; // Countdown to a check for the new program // release, if enabled - sptr< QNetworkReply > latestReleaseReply; + QNetworkReply *latestReleaseReply; sptr< QPrinter > printer; // The printer we use for all printing operations