closing panel from a thread
closing panel from a thread
- Subject: closing panel from a thread
- From: Mudi Dandan <email@hidden>
- Date: Sun, 19 Mar 2006 21:06:00 +0100
Hi,
I'm having hard time with multithreaded programing in cocoa.
I think the docs not too clear about this topic.
I have a thread that opens a panel and does a lengthy task (file
transfer) with a progressbar and an abort button.
The abort button just sets a flag in the while loop to abort the
process, which closes the panel and the thread exits.
It seems to work fine, but when doing some stress test (starting,
aborting, starting, aborting....) it crashes inside the main thread.
The debugger output is:
#0 0xfffeff20 in objc_msgSend_rtp
#1 0x9371bc4c in -[NSButtonCell performClick:]
#2 0x938b3ef4 in -[NSWindow _processKeyboardUIKey:]
#3 0x9371b05c in -[NSWindow keyDown:]
#4 0x93749584 in forwardMethod
#5 0x93749584 in forwardMethod
#6 0x937ea9b0 in -[NSControl keyDown:]
#7 0x936d75c0 in -[NSWindow sendEvent:]
#8 0x9367fef4 in -[NSApplication sendEvent:]
#9 0x93677330 in -[NSApplication run]
#10 0x93767e68 in NSApplicationMain
#11 0x00011fac in main at main.m:13
I guess it happens when abort is pressed while the panel is being
closed from the detached thread.
I tried to close the panel with "performSelectorOnMainThread" but
did not help.
If I don't release the panel it does not crash, but that way I leak
memory.
How could i avoid this?
thx,
Mudi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden