diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index fb69c91c4..e666728aa 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1802,6 +1802,9 @@ MainWindow::removeTab(Tab *tab) if (tabList.count() == 2) showTabbar(false); // don't need it for one! + // cancel ridecache refresh if its in progress + tab->context->athlete->rideCache->cancel(); + // save the named searches tab->context->athlete->namedSearches->write(); diff --git a/src/Gui/TabView.cpp b/src/Gui/TabView.cpp index a2bfb7d50..4a3e63bfd 100644 --- a/src/Gui/TabView.cpp +++ b/src/Gui/TabView.cpp @@ -82,7 +82,10 @@ TabView::TabView(Context *context, int type) : TabView::~TabView() { - if (page_) page_->saveState(); + if (page_) { + page_->saveState(); + delete page_; + } } void diff --git a/src/Gui/Views.cpp b/src/Gui/Views.cpp index 8901edae9..da6164584 100644 --- a/src/Gui/Views.cpp +++ b/src/Gui/Views.cpp @@ -33,13 +33,13 @@ extern QDesktopWidget *desktop; AnalysisView::AnalysisView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_ANALYSIS) { analSidebar = new AnalysisSidebar(context); - HomeWindow *a = new HomeWindow(context, "analysis", "Activities"); - controls->addWidget(a->controls()); + hw = new HomeWindow(context, "analysis", "Activities"); + controls->addWidget(hw->controls()); controls->setCurrentIndex(0); BlankStateAnalysisPage *b = new BlankStateAnalysisPage(context); setSidebar(analSidebar); - setPage(a); + setPage(hw); setBlank(b); setBottom(new ComparePane(context, this, ComparePane::interval)); @@ -57,6 +57,8 @@ RideNavigator *AnalysisView::rideNavigator() AnalysisView::~AnalysisView() { appsettings->setValue(GC_SETTINGS_MAIN_SIDEBAR "analysis", _sidebar); + delete analSidebar; + //delete hw; tabview deletes after save state } void @@ -93,23 +95,25 @@ AnalysisView::isBlank() DiaryView::DiaryView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_DIARY) { - DiarySidebar *s = new DiarySidebar(context); - HomeWindow *d = new HomeWindow(context, "diary", "Diary"); - controls->addWidget(d->controls()); + diarySidebar = new DiarySidebar(context); + hw = new HomeWindow(context, "diary", "Diary"); + controls->addWidget(hw->controls()); controls->setCurrentIndex(0); BlankStateDiaryPage *b = new BlankStateDiaryPage(context); - setSidebar(s); - setPage(d); + setSidebar(diarySidebar); + setPage(hw); setBlank(b); setSidebarEnabled(appsettings->value(this, GC_SETTINGS_MAIN_SIDEBAR "diary", true).toBool()); - connect(s, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange))); + connect(diarySidebar, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange))); } DiaryView::~DiaryView() { appsettings->setValue(GC_SETTINGS_MAIN_SIDEBAR "diary", _sidebar); + delete diarySidebar; + //delete hw; tabview deletes after save state } void @@ -136,13 +140,13 @@ DiaryView::isBlank() HomeView::HomeView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_HOME) { sidebar = new LTMSidebar(context); - HomeWindow *h = new HomeWindow(context, "home", "Trends"); - controls->addWidget(h->controls()); + hw = new HomeWindow(context, "home", "Trends"); + controls->addWidget(hw->controls()); controls->setCurrentIndex(0); BlankStateHomePage *b = new BlankStateHomePage(context); setSidebar(sidebar); - setPage(h); + setPage(hw); setBlank(b); setBottom(new ComparePane(context, this, ComparePane::season)); @@ -156,6 +160,8 @@ HomeView::HomeView(Context *context, QStackedWidget *controls) : TabView(context HomeView::~HomeView() { appsettings->setValue(GC_SETTINGS_MAIN_SIDEBAR "trend", _sidebar); + delete sidebar; + //delete hw; tabview deletes after save state } void @@ -193,13 +199,13 @@ TrainView::TrainView(Context *context, QStackedWidget *controls) : TabView(conte trainTool = new TrainSidebar(context); trainTool->hide(); - HomeWindow *t = new HomeWindow(context, "train", "train"); - controls->addWidget(t->controls()); + hw = new HomeWindow(context, "train", "train"); + controls->addWidget(hw->controls()); controls->setCurrentIndex(0); BlankStateTrainPage *b = new BlankStateTrainPage(context); setSidebar(trainTool->controls()); - setPage(t); + setPage(hw); setBlank(b); trainBottom = new TrainBottom(trainTool, this); @@ -219,6 +225,8 @@ void TrainView::onAutoHideChanged(bool enabled) TrainView::~TrainView() { appsettings->setValue(GC_SETTINGS_MAIN_SIDEBAR "train", _sidebar); + delete trainTool; + //delete hw; tabview deletes after save state } void diff --git a/src/Gui/Views.h b/src/Gui/Views.h index 048a07e19..2ac611f8f 100644 --- a/src/Gui/Views.h +++ b/src/Gui/Views.h @@ -48,9 +48,11 @@ class AnalysisView : public TabView private: AnalysisSidebar *analSidebar; + HomeWindow *hw; }; +class DiarySidebar; class DiaryView : public TabView { Q_OBJECT @@ -66,6 +68,10 @@ class DiaryView : public TabView bool isBlank(); void dateRangeChanged(DateRange); + private: + DiarySidebar *diarySidebar; + HomeWindow *hw; + }; class TrainView : public TabView @@ -87,6 +93,7 @@ class TrainView : public TabView TrainSidebar *trainTool; TrainBottom *trainBottom; + HomeWindow *hw; private slots: void onAutoHideChanged(bool enabled); @@ -103,6 +110,7 @@ class HomeView : public TabView ~HomeView(); LTMSidebar *sidebar; + HomeWindow *hw; signals: void dateChanged(DateRange);