changeset 982:a4425bb24b77

Fixed dw_window_destroy() on container and trees... there are multiple parts to scrollviews aparently on Mac. Also moved the removeFromSuperview further down for safety.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 06 May 2011 07:54:58 +0000
parents 536ec60ee433
children 6abf763838c6
files mac/dw.m
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Fri May 06 07:50:02 2011 +0000
+++ b/mac/dw.m	Fri May 06 07:54:58 2011 +0000
@@ -7258,9 +7258,9 @@
         /* Some controls are embedded in scrollviews... 
          * so get the parent of the scrollview in that case.
          */
-        if([object isKindOfClass:[NSTableView class]] && [parent isMemberOfClass:[NSScrollView class]])
-        {
-            object = parent;
+        if([object isKindOfClass:[NSTableView class]] && [parent isMemberOfClass:[NSClipView class]])
+        {
+            object = [parent superview];
             parent = (DWBox *)[object superview];
         }
 
@@ -7270,11 +7270,9 @@
             int z, index = -1;
             Item *tmpitem, *thisitem = thisbox->items;
 
-            [object removeFromSuperview];
-
             for(z=0;z<thisbox->count;z++)
             {
-                if(thisitem[z].hwnd == handle)
+                if(thisitem[z].hwnd == object)
                     index = z;
             }
 
@@ -7284,6 +7282,8 @@
                 return 0;
             }
 
+            [object removeFromSuperview];
+            
             tmpitem = malloc(sizeof(Item)*(thisbox->count-1));
 
             /* Copy all but the current entry to the new list */