Do not dereference the _engine member variable without check.

This can cause the crash because the _engine member is deleted in the
sync finished slot. The solution is to store the stopWatch object
before the engine is destroyed.

Fixes bug #1675
This commit is contained in:
Klaas Freitag 2014-04-15 16:21:21 +02:00
parent 82ab5fdcb9
commit aee7515d42
2 changed files with 6 additions and 2 deletions

View file

@ -298,7 +298,8 @@ void Folder::bubbleUpSyncResult()
SyncRunFileLog syncFileLog; SyncRunFileLog syncFileLog;
syncFileLog.start(path(), _engine->stopWatch() ); syncFileLog.start(path(), _stopWatch );
_stopWatch.reset();
QElapsedTimer timer; QElapsedTimer timer;
timer.start(); timer.start();
@ -626,6 +627,7 @@ void Folder::slotSyncFinished()
qDebug() << "-> CSync Finished slot with error " << _csyncError << "warn count" << _syncResult.warnCount(); qDebug() << "-> CSync Finished slot with error " << _csyncError << "warn count" << _syncResult.warnCount();
bubbleUpSyncResult(); bubbleUpSyncResult();
_stopWatch = _engine->stopWatch();
_engine.reset(0); _engine.reset(0);
// _watcher->setEventsEnabledDelayed(2000); // _watcher->setEventsEnabledDelayed(2000);

View file

@ -21,6 +21,7 @@
#include "mirall/progressdispatcher.h" #include "mirall/progressdispatcher.h"
#include "mirall/syncjournaldb.h" #include "mirall/syncjournaldb.h"
#include "mirall/clientproxy.h" #include "mirall/clientproxy.h"
#include "mirall/utility.h"
#include <csync.h> #include <csync.h>
@ -186,7 +187,6 @@ private slots:
private: private:
bool init(); bool init();
void setIgnoredFiles(); void setIgnoredFiles();
void bubbleUpSyncResult(); void bubbleUpSyncResult();
@ -217,6 +217,8 @@ private:
ClientProxy _clientProxy; ClientProxy _clientProxy;
Utility::StopWatch _stopWatch;
CSYNC *_csync_ctx; CSYNC *_csync_ctx;
}; };