[haiku-commits] r36592 - haiku/trunk/src/kits/tracker

  • From: alex@xxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 3 May 2010 01:32:55 +0200 (CEST)

Author: aldeck
Date: 2010-05-03 01:32:54 +0200 (Mon, 03 May 2010)
New Revision: 36592
Changeset: http://dev.haiku-os.org/changeset/36592/haiku
Ticket: http://dev.haiku-os.org/ticket/4322
Ticket: http://dev.haiku-os.org/ticket/5780
Ticket: http://dev.haiku-os.org/ticket/3828

Modified:
   haiku/trunk/src/kits/tracker/PoseView.cpp
Log:
* RemoveFromVSList was failing to actually remove some poses due to a buggy 
optimisation. This was causing calls on invalid poses in many places in the 
PoseView code (icon mode). This fixes #4322 (and duplicate #5780). This should 
also fix #3828. Please test. 

   I took the conservative approach and the penalty is really minimal if even 
not at all perceptible as i've measured. I decided to go this way as PoseView 
code is very fragile and depends on many of those "loose assertions" to be 
valid. This conservative approach also allows to confidently include the fix in 
alpha2:
+alphabranch

   Besides those "wise" reasons, the thing is that i've wasted too many hours 
already this week and in the past due that VSPoseList/PoseList syncing 
fragility. I'm not willing to fix the optimisation of a broken design that i've 
already experimentally rewriten two times already, and that i (or any mentally 
sane person) will finally ditch sooner or later :)


Modified: haiku/trunk/src/kits/tracker/PoseView.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/PoseView.cpp   2010-05-02 23:05:38 UTC (rev 
36591)
+++ haiku/trunk/src/kits/tracker/PoseView.cpp   2010-05-02 23:32:54 UTC (rev 
36592)
@@ -3634,7 +3634,13 @@
 int32
 BPoseView::RemoveFromVSList(const BPose *pose)
 {
-       int32 index = FirstIndexAtOrBelow((int32)pose->Location(this).y);
+       //int32 index = FirstIndexAtOrBelow((int32)pose->Location(this).y);
+               // This optimisation is buggy and the index returned can be 
greater
+               // than the actual index of the pose we search, thus missing it
+               // and failing to remove it. This having severe implications
+               // everywhere in the code as it is asserted that it must be 
always
+               // in sync with fPoseList. See ticket #4322.
+       int32 index = 0;
 
        int32 count = fVSPoseList->CountItems();
        for (; index < count; index++) {


Other related posts: