{"action":"created","issue":{"url":"https://api.github.com/repos/andlabs/libui/issues/28","repository_url":"https://api.github.com/repos/andlabs/libui","labels_url":"https://api.github.com/repos/andlabs/libui/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/andlabs/libui/issues/28/comments","events_url":"https://api.github.com/repos/andlabs/libui/issues/28/events","html_url":"https://github.com/andlabs/libui/issues/28","id":155982289,"number":28,"title":"request: add ondestroy handler","user":{"login":"gnarz","id":11943627,"avatar_url":"https://avatars.githubusercontent.com/u/11943627?v=3","gravatar_id":"","url":"https://api.github.com/users/gnarz","html_url":"https://github.com/gnarz","followers_url":"https://api.github.com/users/gnarz/followers","following_url":"https://api.github.com/users/gnarz/following{/other_user}","gists_url":"https://api.github.com/users/gnarz/gists{/gist_id}","starred_url":"https://api.github.com/users/gnarz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnarz/subscriptions","organizations_url":"https://api.github.com/users/gnarz/orgs","repos_url":"https://api.github.com/users/gnarz/repos","events_url":"https://api.github.com/users/gnarz/events{/privacy}","received_events_url":"https://api.github.com/users/gnarz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-20T14:57:15Z","updated_at":"2016-05-20T16:22:09Z","closed_at":null,"body":"I propose to create a function either globally:\r\n`uiOnDestroy(void (*ondestroy)(uiControl*, void*))`\r\nor per widget:\r\n`uiControlOnDestroy(uiControl*, void (*ondestroy)(uiControl*, void*))`\r\nThe passed handler should be called when any widget / the widget it was registered for is destroyed.\r\n\r\nRationale: I am currently writing a binding for this to lua, which is a language with a garbage collector. When I destroy a toplevel control (like a window), all of the contained controls are destroyed, too. But lua has no way of knowing about this, so when there is still a reference to a control that was used in the window, the next time when the garbage collector comes around, controls may be free()d a second time, which leads to a crash."},"comment":{"url":"https://api.github.com/repos/andlabs/libui/issues/comments/220652056","html_url":"https://github.com/andlabs/libui/issues/28#issuecomment-220652056","issue_url":"https://api.github.com/repos/andlabs/libui/issues/28","id":220652056,"user":{"login":"gnarz","id":11943627,"avatar_url":"https://avatars.githubusercontent.com/u/11943627?v=3","gravatar_id":"","url":"https://api.github.com/users/gnarz","html_url":"https://github.com/gnarz","followers_url":"https://api.github.com/users/gnarz/followers","following_url":"https://api.github.com/users/gnarz/following{/other_user}","gists_url":"https://api.github.com/users/gnarz/gists{/gist_id}","starred_url":"https://api.github.com/users/gnarz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnarz/subscriptions","organizations_url":"https://api.github.com/users/gnarz/orgs","repos_url":"https://api.github.com/users/gnarz/repos","events_url":"https://api.github.com/users/gnarz/events{/privacy}","received_events_url":"https://api.github.com/users/gnarz/received_events","type":"User","site_admin":false},"created_at":"2016-05-20T16:22:08Z","updated_at":"2016-05-20T16:22:08Z","body":"I have started along a similar venue, but that was getting way too complicated. An ondestroy handler seemed like a much simpler approach to me. As all control calls go through one function, this shouldn't be too hard.\n\n"}}
{"actor":{"display_login":"gnarz"}}