From: Evan S. <ev...@dr...> - 2005-09-22 04:33:53
|
So I'm facing a bit of confusion regarding the request API. Assume I'm using some sort of reference counting system, and the objects I want to return as handles are destroyed when their reference count is 0 (of course). There are two non-crashing possibilities as I see it: 1. Request window is shown; I increase the reference count to return the handle 2. User interacts with the window, and it closes. 3. There is no three. The reference count is now permanently +1 or 1. Request window is shown; I increase the reference count to return the handle 2. libgaim requests a close of the window via gaim_request_close_with_handle() 3. I close the window and decrease the reference count. If I don't increase the reference count before returning, the following crashy situation occurs: 1. Request window is shown. 2. libgaim requests a close of the window via gaim_request_close_with_handle() 3. I attempt to close the window. If my handle-object was dereferenced elsewhere, it was already destroyed, and I crash when accessing invalid memory. Any thoughts or suggestions? Thanks, Evan www.adiumx.com -------------------------------------- GPG Key: http://evands.penguinmilitia.net/evan_pubkey.txt |