ecere/gui/Window, ListBox: Fixed lockups related to clickThrough, crashes related...
authorJerome St-Louis <jerome@ecere.com>
Tue, 4 Jun 2013 13:59:31 +0000 (09:59 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 4 Jun 2013 13:59:31 +0000 (09:59 -0400)
- The WSMS issue was fixed in Window::GetAtPosition() and replacing the 'last.parent == this' check by last.IsDescendantOf(this)
- The sampleScrolling issue (nicktick's issue, trying to scroll with a right click with buttons within a grouping Window) had to do
   with both the buttons and the group being clickThrough, and at same level, resulting in alternating activation which would move
   windows around in the order). The fix was to set activate = false after performing an activation. The group should actually be
   marked as 'inactive' if the buttons do not have it set as a parent, to work around an otherwise alternate activation on a mouse click.
- Another issue was found in WSMS while testing with the timer: crashes due to clearing a ListBox fields without calling ListBox::Clear()
   first to clear the data. This has now been enforced in ClearFields(), and also fixed in WSMS.

ecere/src/gui/Window.ec
ecere/src/gui/controls/ListBox.ec

index 8caa7a8..7ebc771 100644 (file)
@@ -3206,7 +3206,8 @@ private:
             // If the window is disabled, stop looking in children (for acceptDisabled mode)
             if(!disabled)
             {
-               for(child = (last && last.parent == this) ? last.previous : children.last; child; child = child.prev)
+               bool isD = (last && last.IsDescendantOf(this)); // last.parent == this);  Fix for WSMS (#844)
+               for(child = isD ? (last.previous == children.first ? null : last.previous) : children.last; child; child = child.prev)
                {
                   if(child != statusBar && child.rootWindow == rootWindow)
                   {
@@ -3217,7 +3218,7 @@ private:
                }
                if(clickThru)
                {
-                  for(child = (last && last.parent == this) ? last.previous : children.last; child; child = child.prev)
+                  for(child = isD ? (last.previous == children.first ? null : last.previous) : children.last; child; child = child.prev)
                   {
                      if(child != statusBar && child.rootWindow == rootWindow)
                      {
@@ -4066,6 +4067,8 @@ private:
                            return false;
                         }
                         delete activateWindow;
+                        // Trouble with clickThrough, siblings and activation (Fix for nicktick scrolling, siblings/activation endless loops, #844)
+                        activate = false;
                      }
                      mods->isActivate = true;
                   }
index 5bcec46..6f609dd 100644 (file)
@@ -808,7 +808,7 @@ private:
          {
             DataField field;
             for(field = listBox.fields.first; field && field.index != cellIndex; field = field.next);
-            if(field.dataType)
+            if(field && field.dataType)
             {
                // TOCHECK: Is this check good? Will need incref/decref sometime?
                if(field.dataType.type == normalClass || field.dataType.type == noHeadClass)
@@ -1208,9 +1208,9 @@ public:
       if(this)
       {
          DataField field;
+         Clear();    // Ensure data is cleared first
          while((field = fields.first))
          {
-            //delete field;
             field.Free();
             delete field;
          }