[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Jul 15 23:28:25 CEST 2004


CVS commit by staikos: 

remove extra reference count on the top level view.  one still lurks.


  M +8 -0      ksttoplevelview.cpp   1.62
  M +4 -3      ksttoplevelview.h   1.37
  M +4 -0      kstviewwidget.h   1.17
  M +13 -15    kstviewwindow.cpp   1.27
  M +0 -13     kstviewwindow.h   1.15


--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.61:1.62
@@ -59,4 +59,5 @@ void KstTopLevelView::commonConstructor(
 
 KstTopLevelView::~KstTopLevelView() {
+  kdDebug() << " Destroy toplevel view" <<  endl;
 }
 
@@ -832,4 +834,10 @@ void KstTopLevelView::cleanupAction() {
 
 
+void KstTopLevelView::release() {
+  if (_w) {
+    _w->release();
+  }
+}
+
 #include "ksttoplevelview.moc"
 // vim: ts=2 sw=2 et

--- kdeextragear-2/kst/kst/ksttoplevelview.h  #1.36:1.37
@@ -20,9 +20,8 @@
 
 #include <qcursor.h>
+#include <qguardedptr.h>
 #include <qpainter.h>
 #include <qwidget.h>
 
-#include <kprinter.h>
-
 #include "kstplotbase.h"
 #include "kstviewobject.h"
@@ -42,4 +41,6 @@ class KstTopLevelView : public KstViewOb
     virtual void save(QTextStream& ts);
 
+    void release(); // Release this from it's window/view.  When you call this,
+                    // you'd better be deleting this object in the next line.
     KstViewWidget *widget() const;
 
@@ -100,5 +101,5 @@ class KstTopLevelView : public KstViewOb
     void commonConstructor();
 
-    KstViewWidget *_w;
+    QGuardedPtr<KstViewWidget> _w;
     bool _focusOn : 1;
     bool _mouseGrabbed : 1;

--- kdeextragear-2/kst/kst/kstviewwidget.h  #1.16:1.17
@@ -59,4 +60,7 @@ class KstViewWidget : public QWidget {
     virtual void wheelEvent(QWheelEvent *e);
 
+    friend class KstTopLevelView;
+    void release() { _view = 0L; }
+
   private:
     KstTopLevelViewPtr _view;

--- kdeextragear-2/kst/kst/kstviewwindow.cpp  #1.26:1.27
@@ -126,4 +126,7 @@ void KstViewWindow::updateActions() {
 KstViewWindow::~KstViewWindow() {
   KstApp::inst()->updateDialogsForWindow();
+  kdDebug() << "View window deleted - usage is at " << _view->_KShared_count() << endl;
+  _view->release(); // bye bye - remove circular dependency and disappear
+  kdDebug() << "View released - usage is at " << _view->_KShared_count() << endl;
 }
 
@@ -224,6 +235,6 @@ void KstViewWindow::immediatePrintToPng(
 }
 
-void KstViewWindow::immediatePrintToPng(const QString &filename, const QSize& size, const QString &format) {
 
+void KstViewWindow::immediatePrintToPng(const QString &filename, const QSize& size, const QString &format) {
   if (!view()->children().isEmpty()) {
     QPainter paint;
@@ -251,18 +262,4 @@ void KstViewWindow::immediatePrintToPng(
 }
 
-void KstViewWindow::toggleDataMode() {
-}
-
-void KstViewWindow::samplesUp() {
-}
-
-void KstViewWindow::samplesDown() {
-}
-
-void KstViewWindow::samplesEnd() {
-}
-
-void KstViewWindow::slotCopy() {
-}
 
 void KstViewWindow::save(QTextStream& ts) {

--- kdeextragear-2/kst/kst/kstviewwindow.h  #1.14:1.15
@@ -83,7 +83,4 @@ class KstViewWindow : public KMdiChildVi
     void updateActions();
 
-    // for the kaction
-    void toggleDataMode();
-
     void slotActivated(KMdiChildView*);
 
@@ -102,14 +99,4 @@ class KstViewWindow : public KMdiChildVi
     void immediatePrintToPng(QDataStream* pStream, const QSize& size, const QString &format = "PNG");
     void immediatePrintToPng(const QString& filename, const QSize& size, const QString& format = "PNG");
-    void slotCopy();
-
-    /** calls doc->samplesDown */
-    void samplesDown();
-
-    /** calls doc->samplesUp */
-    void samplesUp();
-
-    /** calls doc->samplesEnd */
-    void samplesEnd();
 
   public:





More information about the Kst mailing list