Don't delete latest release reply directly in slot

This commit is contained in:
Abs62 2013-06-07 16:59:18 +04:00
parent 92db6d2d3e
commit cce47a77c3
2 changed files with 8 additions and 5 deletions

View file

@ -76,6 +76,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
dictNetMgr( this ), dictNetMgr( this ),
wordFinder( this ), wordFinder( this ),
newReleaseCheckTimer( this ), newReleaseCheckTimer( this ),
latestReleaseReply( 0 ),
wordListSelChanged( false ) wordListSelChanged( false )
, wasMaximized( false ) , wasMaximized( false )
, blockUpdateWindowTitle( false ) , blockUpdateWindowTitle( false )
@ -2547,7 +2548,8 @@ void MainWindow::prepareNewReleaseChecks()
void MainWindow::checkForNewRelease() void MainWindow::checkForNewRelease()
{ {
latestReleaseReply.reset(); if( latestReleaseReply )
latestReleaseReply->deleteLater();
QNetworkRequest req( QNetworkRequest req(
QUrl( "http://goldendict.org/latest_release.php?current=" QUrl( "http://goldendict.org/latest_release.php?current="
@ -2568,13 +2570,13 @@ void MainWindow::checkForNewRelease()
latestReleaseReply = articleNetMgr.get( req ); latestReleaseReply = articleNetMgr.get( req );
connect( latestReleaseReply.get(), SIGNAL( finished() ), connect( latestReleaseReply, SIGNAL( finished() ),
this, SLOT( latestReleaseReplyReady() ), Qt::QueuedConnection ); this, SLOT( latestReleaseReplyReady() ), Qt::QueuedConnection );
} }
void MainWindow::latestReleaseReplyReady() void MainWindow::latestReleaseReplyReady()
{ {
if ( !latestReleaseReply.get() ) if ( !latestReleaseReply )
return; // Some stray signal return; // Some stray signal
bool success = false; bool success = false;
@ -2594,7 +2596,8 @@ void MainWindow::latestReleaseReplyReady()
} }
} }
latestReleaseReply.reset(); latestReleaseReply->deleteLater();
latestReleaseReply = 0;
if ( !success ) if ( !success )
{ {

View file

@ -145,7 +145,7 @@ private:
QTimer newReleaseCheckTimer; // Countdown to a check for the new program QTimer newReleaseCheckTimer; // Countdown to a check for the new program
// release, if enabled // release, if enabled
sptr< QNetworkReply > latestReleaseReply; QNetworkReply *latestReleaseReply;
sptr< QPrinter > printer; // The printer we use for all printing operations sptr< QPrinter > printer; // The printer we use for all printing operations