From: Olivier Goffart Date: Mon, 29 May 2017 08:48:21 +0000 (+0200) Subject: Don't call QElapsedTimer::restart on uninitialized timer X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~711 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f88431adbf57ddd7af3952bcea3f993467fb3032;p=nextcloud-desktop.git Don't call QElapsedTimer::restart on uninitialized timer That's an undefined behavior. Since we don't use the return value anyway, we should just use start() --- diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index e5c871f84..e7ed89bc2 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -160,7 +160,7 @@ bool AccountState::isConnected() const void AccountState::tagLastSuccessfullETagRequest() { - _timeSinceLastETagCheck.restart(); + _timeSinceLastETagCheck.start(); } void AccountState::checkConnectivity() diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp index 6a55001c0..2d40ce8ee 100644 --- a/src/gui/activitywidget.cpp +++ b/src/gui/activitywidget.cpp @@ -348,7 +348,7 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list) if (newGuiLogCount > 0) { // restart the gui log timer now that we show a notification - _guiLogTimer.restart(); + _guiLogTimer.start(); // Assemble a tray notification QString msg = tr("You received %n new notification(s) from %2.", "", accNotified[accNotified.keys().at(0)]).arg(accNotified.keys().at(0)); diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index b17a87d0d..7c0094952 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -629,7 +629,7 @@ void Folder::startSync(const QStringList &pathList) } _csyncUnavail = false; - _timeSinceLastSyncStart.restart(); + _timeSinceLastSyncStart.start(); _syncResult.setStatus(SyncResult::SyncPrepare); emit syncStateChange(); @@ -798,7 +798,7 @@ void Folder::slotSyncFinished(bool success) QTimer::singleShot(200, this, SLOT(slotEmitFinishedDelayed())); _lastSyncDuration = _timeSinceLastSyncStart.elapsed(); - _timeSinceLastSyncDone.restart(); + _timeSinceLastSyncDone.start(); // Increment the follow-up sync counter if necessary. if (anotherSyncNeeded == ImmediateFollowUp) { diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index c4c3c8743..c8f13784b 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -159,11 +159,11 @@ void DiscoveryJob::update_job_update_callback(bool local, if (updateJob) { // Don't wanna overload the UI if (!updateJob->_lastUpdateProgressCallbackCall.isValid()) { - updateJob->_lastUpdateProgressCallbackCall.restart(); // first call + updateJob->_lastUpdateProgressCallbackCall.start(); // first call } else if (updateJob->_lastUpdateProgressCallbackCall.elapsed() < 200) { return; } else { - updateJob->_lastUpdateProgressCallbackCall.restart(); + updateJob->_lastUpdateProgressCallbackCall.start(); } QByteArray pPath(dirUrl);