GNOME Bugzilla – Bug 782254
Crash in maps_contact_store_dispose
Last modified: 2017-05-08 21:10:25 UTC
Ubuntu 17.04 with gnome-maps 3.24, gjs 1.48.0 and 1.48.2 has been receiving crash reports: gjs-console (11) g_slice_free_chain_with_offset → g_list_free → maps_contact_store_dispose → g_object_unref → release_native_object
+ Trace 237424
.
+ Trace 237425
Thread 9 (Thread 0x7f7ee37fe700 (LWP 12901))
Thread 1 (Thread 0x7f7fba8ec600 (LWP 12638))
There are hundreds of reports in Ubuntu's crash database for this issue.
The ::dispose() virtual function can be called multiple times. If you free some data inside there, you also need to set the pointer to NULL, and check for NULL. In this case: - g_list_free (store->priv->list); - g_object_unref (store->priv->aggregator); + g_clear_pointer (&store->priv->list, g_list_free) + g_clear_object (&store->priv->aggregator);
As Emmanuele suggested on IRC, it could be that this was exposed by SpiderMonkey's improved garbage collector, where in previous versions whatever JS object was holding on to the contact store was never garbage collected.
Created attachment 351388 [details] [review] contactStore: Avoid use-after free Clear pointers in dispose vfunc to avoid crashes when ::dispose() is called multiple times on the contact store object.
Attachment 351388 [details] pushed as f75562e - contactStore: Avoid use-after free
I took the liberty of pushing this to get it in for 3.24.2 :)