Skip to content

Commit

Permalink
crash fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
spencersalazar committed Dec 22, 2012
1 parent 061fbd1 commit 67973f6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
15 changes: 12 additions & 3 deletions MAUI/miniAudicle_ui_elements_mac.mm
Expand Up @@ -195,6 +195,8 @@ - (void)setMasterView:(NSView *)v
withObject:nil
waitUntilDone:YES];

native_element = NULL;

return TRUE;
}

Expand Down Expand Up @@ -307,8 +309,13 @@ - (void)hide

- (void)destroy
{
[panel close];
[panel release];
if(panel != nil)
{
[panel close];
[panel release];
panel = nil;
}

[self autorelease];
}

Expand Down Expand Up @@ -406,6 +413,8 @@ - (void)addElement:(mAUIElement *)e
withObject:nil
waitUntilDone:YES];

native_view = NULL;

return TRUE;
}

Expand Down Expand Up @@ -437,7 +446,7 @@ - (void)addElement:(mAUIElement *)e
if( elements[i] == e )
{
elements[i]->remove_parent( this );
elements[i] = NULL;
elements[i] = NULL; // SPENCERTODO: why not use list<> and remove?
}
}

Expand Down
12 changes: 12 additions & 0 deletions MAUI/test/memleak.ck
@@ -0,0 +1,12 @@

while(true)
{
MAUI_View myWinder;
MAUI_Button butt;
butt.name("BUTT!");
myWinder.addElement(butt);
myWinder.display();
0.25 :: second => now;
myWinder.destroy();
0.25 :: second => now;
}
9 changes: 9 additions & 0 deletions MAUI/test/perry1.ck
@@ -0,0 +1,9 @@
MAUI_View myWinder;
MAUI_Button butt;
butt.name("BUTT!");
myWinder.addElement(butt);
myWinder.display();
while (butt.state()==0) {
0.01 :: second => now;
}
myWinder.destroy();
9 changes: 9 additions & 0 deletions MAUI/test/perry2.ck
@@ -0,0 +1,9 @@

MAUI_View view;
MAUI_Button butt;
butt.name("Butt");
view.addElement(butt);
view.display;
1.0 :: second => now;
view.destroy;

0 comments on commit 67973f6

Please sign in to comment.