[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Jul 15 04:22:57 CEST 2004


CVS commit by staikos: 

delay object instantiation if and until we need it, and check return code of
dynamic_cast for null


  M +7 -8      kstplotdialog_i.cpp   1.53


--- kdeextragear-2/kst/kst/kstplotdialog_i.cpp  #1.52:1.53
@@ -798,16 +798,14 @@ void KstPlotDialogI::updateSampLegendLab
 void KstPlotDialogI::updatePlotMarkers() {
   KstApp* app = KstApp::inst();
-  Kst2DPlotPtr plot;
 
   PlotMarkerList->clear();
 
-  QValueList<double>::const_iterator it;
-
   KMdiChildView *c = app->findWindow(_window->currentText());
   if (Select->count() && c) {
     KstViewObjectPtr obj = static_cast<KstViewWindow*>(c)->view()->findChild(Select->currentText());
-    plot = dynamic_cast<Kst2DPlot*>(obj.data());
+    Kst2DPlotPtr plot = dynamic_cast<Kst2DPlot*>(obj.data());
 
-    for (it = plot->plotMarkers().begin(); it != plot->plotMarkers().end(); it++) {
+    if (plot) {
+      for (QValueList<double>::ConstIterator it = plot->plotMarkers().begin(); it != plot->plotMarkers().end(); it++) {
       QString stringnum;
       stringnum.setNum(*it, 'f', 64);
@@ -815,4 +813,5 @@ void KstPlotDialogI::updatePlotMarkers()
     }
   }
+  }
 }
 





More information about the Kst mailing list