From 0da59285cfe4f670394d8863efd5cd8779e5bf72 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Tue, 19 Nov 2019 13:38:57 +0200 Subject: [PATCH] Reader: fix QTimer-related memory leaks --- YACReader/main_window_viewer.cpp | 6 +----- YACReader/viewer.cpp | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index bf081aa3..004756a2 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -1217,11 +1217,7 @@ void MainWindowViewer::checkNewVersion() connect(versionChecker, SIGNAL(newVersionDetected()), this, SLOT(newVersion())); - auto tT = new QTimer; - tT->setSingleShot(true); - connect(tT, SIGNAL(timeout()), versionChecker, SLOT(get())); - //versionChecker->get(); //TOD� - tT->start(100); + QTimer::singleShot(100, versionChecker, &HttpVersionChecker::get); conf.setLastVersionCheck(current); } diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index eeae72e2..bbabc04c 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -161,7 +161,7 @@ void Viewer::createConnections() connect(goToFlow, SIGNAL(goToPage(unsigned int)), this, SLOT(goTo(unsigned int))); //current time - auto t = new QTimer(); + auto t = new QTimer(this); connect(t, SIGNAL(timeout()), this, SLOT(updateInformation())); t->start(1000);