While working on the python plugin, I realised that the timeout system does not allow for notification when a timeout is removed. This has been fine up until now because he closures never needed to be cleaned up. In the python plugin, I pass through a custom structure which needs to be cleaned up if the timeout is removed. This is almost certainly the cause of some horrible memory leaks for me. The attached patch is a simple solution to the problem. I think it should be good enough for most situations. I could maintain some sort of lookup inside my plugin, but I think other plugins would benefit from this. It is OK to go in or were there any comments? -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-remove-callback-to-timeouts.patch Type: text/x-patch Size: 7164 bytes Desc: not available Url : http://lists.freedesktop.org/archives/compiz/attachments/20070423/cc7656e6/0001-Add-remove-callback-to-timeouts-0001.bin
On Mon, 2007-04-23 at 14:28 +0100, Mike Dransfield wrote:> While working on the python plugin, I realised that the > timeout system does not allow for notification when a timeout > is removed. This has been fine up until now because he closures > never needed to be cleaned up. > > In the python plugin, I pass through a custom structure which > needs to be cleaned up if the timeout is removed. This is almost > certainly the cause of some horrible memory leaks for me. > > The attached patch is a simple solution to the problem. I think > it should be good enough for most situations. > > I could maintain some sort of lookup inside my plugin, but I think > other plugins would benefit from this. > > It is OK to go in or were there any comments?Timeouts are only removed as a result of the timeout call-back function returning FALSE. So unless I'm missing something, all cleanup can be done in the regular call-back function before returning FALSE. - David