Permalink
Browse files

Fix quickfire exit crash

.. 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 2c6e54bee5fab276ae8858efae15285af73a412a
Showing with 10 additions and 1 deletion.
  1. +7 −1 src/RideSummaryWindow.cpp
  2. +3 −0 src/RideSummaryWindow.h
@@ -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()
{
@@ -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 {
View
@@ -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(); }
@@ -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

0 comments on commit 2c6e54b

Please sign in to comment.