GNOME Bugzilla – Bug 719563
input-device: Guard against double free
Last modified: 2013-12-02 14:43:02 UTC
See patch.
Created attachment 263133 [details] [review] input-device: Guard against double free Dispose() may be called more than once, so calling g_free directly on the device name is unsafe. Instead, use g_clear_pointer() to make sure we don't attempt to free the memory again.
*** Bug 719664 has been marked as a duplicate of this bug. ***
Review of attachment 263133 [details] [review]: okay. please, push to the clutter-1.18 and clutter-1.16 branches.
Attachment 263133 [details] pushed as f9e8c21 - input-device: Guard against double free
I managed to get a crash that pointed here, but it was caused by the recent cogl commits causing Clutter to call an unknown method and corrupted memory. Have you got this legitimately? How did the input devices get disposed twice?
(In reply to comment #5) > How did the input devices get disposed twice? I didn't check that, but dispose being called multiple times is legitimate and documented behavior[0]. And yes, "my" crash was actually caused by this - glibc complaining about double-free and the stacktrace pointing to this code. Oh, and the patch fixing it of course :-) [0] https://git.gnome.org/browse/glib/tree/gobject/gobject.h#n266
Yes, dispose can be called multiple times, but that doesn't mean it will always happen at object destruction time. Looking through the code, I can't figure out any way that a double-dispose will happen. I saw this glibc double-free error, but when I investigated, it was memory corruption caused by undefined symbols from cogl. I still don't know what's up with those undefined symbols btw -- I just reverted the top patch on cogl-1.18 locally, and it fixed it.