Re: [Pyobjc-dev] Memory Management Problem - Objects being deallocated
Brought to you by:
ronaldoussoren
From: Lukas P. | D. V. <lu...@dr...> - 2009-09-29 20:09:44
|
A different question, would it negatively affect to plugin if I used retain, wherever the original objective-c code uses it? Lukas Am 29.09.2009 um 19:28 schrieb James R Eagan: > Hi Lukas, > > Most likely PyObjC is doing the right thing, just not what you > expect. I suppose it depends on your definition of the right thing, > though. It's hard to say what's happening based on what you've > given, but it sounds like you might have a case of unretained > delegates. > > PyObjC will hold an ObjC reference (i.e. retain) any objects on its > side of the bridge. Remember that for some Cocoa delegates and data > providers, you are expected to retain a copy of the data source > (e.g. NSTableView dataSource). If you don't make sure you keep a > python reference to that object, then PyObjC will no longer keep the > ObjC reference, and the object will be released. So the first place > I'd look is to make sure you're keeping a python reference to all > your dataSource's and other appropriate delegates (the Cocoa > documentation is your friend here). > > Good luck! > James > > On 29 sept. 2009, at 18:34, Lukas Pitschl | Dressy Vagabonds wrote: > >> At the moment I'm re-implementing the GPGMail Plugin in PyObjC and I >> noticed >> that sometimes the Mail.app crashes because PyObjC is accessing >> memory >> that >> is no longer allocated. >> >> As the documentation mentions memory management should be left to >> PyObjC >> I wonder how this can happen. >> >> Should i use retain on the object? Any suggestions how to find the >> objects that are causing the problem >> or debug this situation further? >> >> Greets >> >> Lukas >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry® Developer Conference in SF, >> CA >> is the only developer event you need to attend this year. Jumpstart >> your >> developing skills, take BlackBerry mobile applications to market >> and stay >> ahead of the curve. Join us from November 9-12, 2009. Register >> now! >> http://p.sf.net/sfu/devconf >> _______________________________________________ >> Pyobjc-dev mailing list >> Pyo...@li... >> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > |