discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: releasing a thread object (Gworkspace)


From: Riccardo Mottola
Subject: Re: releasing a thread object (Gworkspace)
Date: Tue, 21 Oct 2014 11:53:20 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0 SeaMonkey/2.30

Hi,

Ivan Vučica wrote:
Why not override -[FilOpExecutor retain] temporarily?

While it'll be very verbose and is very non-recommended in production code, it'll allow you to set a breakpoint and figure out what's trying to retain the object. Sure, it'll be a lot of effort to track it down... but hey, that's why debugging is hard.
I indeed remain at release count 1, so clearly miss a release somewhere (or have one retain too much).

however, if I remove any of the retains I think I could do without, I get a crash. So the problem is the release.

However, i don't know where to release! When may I release the object executing the thread? I thought tat releasing it in the NSThreadWillExitNotificaion would be nice, but what happens is that there the object is already invalid.

"An |NSThread| object posts this notification when it receives the |exit <https://developer.apple.com/library/IOs/documentation/Cocoa/Reference/Foundation/Classes/NSThread_Class/index.html#//apple_ref/occ/clm/NSThread/exit>| message, before the thread exits. Observer methods invoked to receive this notification execute in the exiting thread, before it exits."

so, well, it exited! This confuses me: it exits and does not release, but i can't release it afterwards. A call to detachNewThreadSelector may involve oneway methods, thus asynchornous stuff, it is not that I can just put a release at the end (which end?)


Riccardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]