Skip to content

Commit

Permalink
Fix quickfire exit crash
Browse files Browse the repository at this point in the history
.. as getPDEstimates is still running in the background and
   we need to wait for it to finish in RideSummaryWindow.
  • Loading branch information
liversedge committed Jun 10, 2014
1 parent 97b1eb4 commit 2c6e54b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/RideSummaryWindow.cpp
Expand Up @@ -115,6 +115,12 @@ RideSummaryWindow::RideSummaryWindow(Context *context, bool ridesummary) :
configChanged(); // set colors
}

RideSummaryWindow::~RideSummaryWindow()
{
// wait for background thread if needed
future.waitForFinished();
}

void
RideSummaryWindow::configChanged()
{
Expand Down Expand Up @@ -545,7 +551,7 @@ RideSummaryWindow::htmlSummary()
// ugh .. refresh in background
WPrimeStringWPK = CPStringWPK = FTPStringWPK = PMaxStringWPK =
WPrimeString = CPString = FTPString = PMaxString = "-";
QFuture<void> future = QtConcurrent::run(this, &RideSummaryWindow::getPDEstimates);
future = QtConcurrent::run(this, &RideSummaryWindow::getPDEstimates);

} else {

Expand Down
3 changes: 3 additions & 0 deletions src/RideSummaryWindow.h
Expand Up @@ -59,6 +59,7 @@ class RideSummaryWindow : public GcChartWindow

// two modes - summarise ride or summarise date range
RideSummaryWindow(Context *context, bool ridesummary = true);
~RideSummaryWindow();

// properties
int useSelected() { return dateSetting->mode(); }
Expand Down Expand Up @@ -148,6 +149,8 @@ class RideSummaryWindow : public GcChartWindow
QString WPrimeStringWPK, CPStringWPK, FTPStringWPK, PMaxStringWPK;

bool force; // to force a replot

QFuture<void> future; // used by QtConcurrent
};

#endif // _GC_RideSummaryWindow_h
Expand Down

0 comments on commit 2c6e54b

Please sign in to comment.