[Kst] branches/work/kst/portto4/kst/src/libkstapp

Peter Kümmel syntheticpp at gmx.net
Wed Mar 23 21:37:12 CET 2011


SVN commit 1225837 by kuemmel:

fix crash: unregister plots that will be deleted

 M  +7 -0      plotitemmanager.cpp  
 M  +5 -1      plotitemmanager.h  
 M  +2 -0      view.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitemmanager.cpp #1225836:1225837
@@ -200,6 +200,13 @@
 }
 
 
+void PlotItemManager::clearPlotsForView(View *view) {
+  if (PlotItemManager::self()->_plotLists.contains(view)) {
+    PlotItemManager::self()->_plotLists.remove(view);
+  }
+}
+
+
 QList<PlotItem*> PlotItemManager::tiedZoomPlotsForView(View *view) {
   if (kstApp->mainWindow()->isTiedTabs()) {
     QList<PlotItem*> plots;
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemmanager.h #1225836:1225837
@@ -28,13 +28,17 @@
 class PlotItemManager : public QObject
 {
   Q_OBJECT
+
   public:
+    static PlotItemManager *self();
+
     static QList<PlotItem*> plotsForView(View *view);
+    static void clearPlotsForView(View *view);
+
     static QList<PlotItem*> tiedZoomPlotsForView(View *view);
     static QList<PlotItem*> tiedZoomPlotsForViewItem(ViewItem *viewItem);
     static QList<PlotItem*> tiedZoomPlots(PlotItem* plotItem);
     static QList<ViewItem*> tiedZoomViewItems(PlotItem* plotItem);
-    static PlotItemManager *self();
 
     void toggleAllTiedZoom(View *view);
 
--- branches/work/kst/portto4/kst/src/libkstapp/view.cpp #1225836:1225837
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *                                                                         *
  *   copyright : (C) 2007 The University of Toronto                        *
@@ -107,6 +108,7 @@
 
 View::~View() {
   // PlotItems are QGraphicsItems and managed by Qt's graphic view
+  PlotItemManager::clearPlotsForView(this);
   delete _undoStack;
   delete _layoutBoxItem;
 }


More information about the Kst mailing list