Bug 120751 - Can't delete view objects
Summary: Can't delete view objects
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: VHI normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-25 00:21 UTC by Netterfield
Modified: 2006-01-25 02:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Netterfield 2006-01-25 00:21:18 UTC
Version:           1.2.0_devel (using KDE 3.4.3, Gentoo)
Compiler:          gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.14-gentoo-r5

Create a plot.

Create a view object in the plot, as a child of the plot (eg, a box completely included in a 2dplot.).

Go into layout mode.  RMB->delete on the view object.

It doesn't disappear.  It should.

NOTE: If the view object is a child of the tlv (eg, have it straddle two plots), rather than the child of the plot, then it is deleted.

Critical for 1.2
Comment 1 Netterfield 2006-01-25 00:22:22 UTC
I did get kst to crash while playing around with this.  It may or may not be related.
Comment 2 Andrew Walker 2006-01-25 02:25:06 UTC
SVN commit 502164 by arwalker:

BUG:120751 The line rc == rc && (*i)->removeChild(obj, true) in KstViewObject::removeChild(...) was not having the desired effect as if rc is false the rest of the line is ignored. The solution is to simply reverse the order of the operation.

 M  +3 -1      kstviewobject.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #502163:502164
@@ -461,13 +461,15 @@
 
 bool KstViewObject::removeChild(KstViewObjectPtr obj, bool recursive) {
   bool rc = _children.remove(obj) > 0;
+  
   if (recursive) {
     for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
-      rc = rc && (*i)->removeChild(obj, true);
+      rc = (*i)->removeChild(obj, true) && rc;
     }
   }
 
   obj->_parent = 0L;
+  
   return rc;
 }