Bug 84370

Summary: Curves still used after plots are deleted
Product: [Applications] kst Reporter: Rick Chern <rchern>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rick Chern 2004-07-02 20:09:12 UTC
Version:           0.98-devel (using KDE KDE 3.2.1)
Installed from:    RedHat RPMs
Compiler:          gcc (GCC) 3.3.2 20031022 
OS:                Linux

When a plot with curves in it is deleted, the curves "# Used" count does not go down. 

How to reproduce:

- start kst and produce a plot of any curve
- delete the plot (by clicking Delete from plot dialog, or right-clicking the plot and choosing Delete)
- open the Data Manager.  The curve will still have a reference count of 1.

This happens with equations, histograms, powerspectra, etc.

However, creating an arbitrary new data object and placing it in a new plot, and then deleting the plot, will refresh the count to 0 for previous data objects.  The new data object still has an incorrect count of 1 though.
Comment 1 Matthew Truch 2004-07-14 21:36:04 UTC
This bug exists in the 0.98 release as well.  It also occurs (ie reference count does not decrement) if you close a window containing (a) plot(s).  
Comment 2 Matthew Truch 2004-07-15 00:31:05 UTC
Correction...
In the 0.98 release, it only seems to occur when you have more than one window (tab), and you close the window (which deletes the plots on it).  If you delete the plots in other ways, the counter is decremented properly.  
Comment 3 George Staikos 2004-07-15 01:43:40 UTC
On Wednesday 14 July 2004 15:36, Matthew Truch wrote:
> This bug exists in the 0.98 release as well.  It also occurs (ie reference
> count does not decrement) if you close a window containing (a) plot(s).

  Known issue and documented in the release notes.  Needs investigation still.

Comment 4 George Staikos 2004-07-15 23:46:50 UTC
CVS commit by staikos: 

Make usage counts sync up again - by removing the stale reference in
KstTopLevelView
CCMAIL: 84370-done@bugs.kde.org


  M +0 -2      devel-docs/RELEASE_PLAN   1.9
  M +15 -16    kst/ksttoplevelview.cpp   1.64


--- kdeextragear-2/kst/devel-docs/RELEASE_PLAN  #1.8:1.9
@@ -60,10 +60,8 @@
 - using QWaitCondition in update thread is bad - it's broken in all but the
   most recent Qt releases (George)
-- Kst Settings reportedly don't work (can someone explain?)
 - Barth can't get event vectors to 'work'.  What are they suppose to do?
         (Andrew?)
 - locking is missing in places - especially dialogs (plugin, etc) (Can
           George verify this? - Yes)
-- Deleting a window doesn't properly delete plots, leading to orphaned objects.
 - data wizard UI needs to be fixed
 - flicker was reintroduced (see layout mode for an example)

--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.63:1.64
@@ -607,5 +607,5 @@ bool KstTopLevelView::popupMenu(KPopupMe
   if (_selectionList.count() > 1) {
     if (_pressTarget && _mode == LayoutMode) {
-      KPopupMenu* pPopup;
+      KPopupMenu* subMenu;
 
       if (rc) {
@@ -613,20 +613,17 @@ bool KstTopLevelView::popupMenu(KPopupMe
       }
 
-      pPopup = new KPopupMenu(menu);
-      if (pPopup) {
-        pPopup->insertItem(i18n("Width"), this, SLOT(makeSameWidth()));
-        pPopup->insertItem(i18n("Height"), this, SLOT(makeSameHeight()));
-        pPopup->insertItem(i18n("Size"), this, SLOT(makeSameSize()));
-        menu->insertItem(i18n("Make Same"), pPopup);
-      }
+      subMenu = new KPopupMenu(menu);
+      subMenu->insertItem(i18n("Width"), this, SLOT(makeSameWidth()));
+      subMenu->insertItem(i18n("Height"), this, SLOT(makeSameHeight()));
+      subMenu->insertItem(i18n("Size"), this, SLOT(makeSameSize()));
+      menu->insertItem(i18n("Make Same"), subMenu);
 
-      pPopup = new KPopupMenu(menu);
-      if (pPopup) {
-        pPopup->insertItem(i18n("Left"), this, SLOT(alignLeft()));
-        pPopup->insertItem(i18n("Right"), this, SLOT(alignRight()));
-        pPopup->insertItem(i18n("Top"), this, SLOT(alignTop()));
-        pPopup->insertItem(i18n("Bottom"), this, SLOT(alignBottom()));
-        menu->insertItem(i18n("Align"), pPopup);
-      }
+      subMenu = new KPopupMenu(menu);
+      subMenu->insertItem(i18n("Left"), this, SLOT(alignLeft()));
+      subMenu->insertItem(i18n("Right"), this, SLOT(alignRight()));
+      subMenu->insertItem(i18n("Top"), this, SLOT(alignTop()));
+      subMenu->insertItem(i18n("Bottom"), this, SLOT(alignBottom()));
+
+      menu->insertItem(i18n("Align"), subMenu);
       menu->insertSeparator();
     }
@@ -643,4 +640,6 @@ bool KstTopLevelView::popupMenu(KPopupMe
   }
 
+  _pressTarget = 0L; // release reference
+
   return rc;
 }