GNOME Bugzilla – Bug 728337
[bisected] Maps gets segmentation fault at start
Last modified: 2014-07-02 11:42:04 UTC
Hi, When starting Maps I almost at once get a segmentation fault, the window is drawn, but after that it goes. I bisected gjs and found: commit 5719e781e95e8f693db616ef0f7b77cbc730186d Author: Cosimo Cecchi <cosimoc@gnome.org> Date: Thu Feb 27 14:05:41 2014 -0800 all: schedule a full GC check after executing JS code After we return from JS::Call* or JS::Evaluate*, schedule a GC check for the next idle iteration, to prevent memory consumption skyrocketing. https://bugzilla.gnome.org/show_bug.cgi?id=725099 This was the first bad commit. Reverting it on master made Maps work again. Running through gdb gives this: Program received signal SIGSEGV, Segmentation fault. 0xb7941d5e in g_object_steal_qdata (object=0x86b71c8, quark=657) at gobject.c:3361 3361 g_return_val_if_fail (G_IS_OBJECT (object), NULL); (gdb) bt
+ Trace 233478
Any ideas?
The G_IS_OBJECT() call is failing, which means it is very likely a memory management bug in maps (in the C libraries or in the GIR annotations), that was just uncovered by the new GC in gjs. You should try to understand what object is supposed to be there (you can look at the gtype and GIObjectInfo in ObjectInstance *priv, at object_instance_finalize()), and see where it is freed. A valgrind run would also give you some hint on where to look.
The problem is in libchamplain, Champlain uses a GObject called MapSource that is GInitiallyUnowned. When you set a map source on a ChamplainView it will do the correct thing and call g_object_ref_sink to remove the floating reference. But in the champlain_view_init where an initial default map source is created there is no g_object_ref_sink call. So when Maps sets a MapSource on start there will be a call to g_object_unref on a floating reference.
Created attachment 274743 [details] [review] ChamplainView: Sink initial MapSource reference We need to call g_object_ref_sink on the initial MapSource otherwise we will call g_object_unref on a floating reference when a new MapSource is set.
Review of attachment 274743 [details] [review]: Thanks for looking into this.
*** Bug 732503 has been marked as a duplicate of this bug. ***