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 ),
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 )
{

View file

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