GNOME Bugzilla – Bug 726812
Introspection fails with evince-3.11.91 and gtk-3.11.8
Last modified: 2014-03-30 10:21:12 UTC
This is with introspection 1.39.90, evince 3.11.91 anbd gtk 3.11.8. When building evince 3.11.90 with introspection enabled the build crashes. I enabled GI_SCANNER_DEBUG=save-temps so that introspection keeps the temporal files needed to reproduce the problem. I also built gtk and evince with debug symbols. It would appear the build fails because gdk_screen_get_setings gets called with screen=0x0 and so when dereferencing the pointer the build gets killed with a segfault. The command evince executes is: EvinceView-3.0 --introspect-dump=functions.txt,dump.xml This is the backtrace of the command introspection issues: http://pastebin.com/yVDiQTUN I've been told that "the issue is that introspection needs to be able to initialize all your GTypes but will not call any initialization functions (gtk or your own) before doing that". Don't know if it is evince's or introspection's fault, or if screen needs to be checked. This issue prevents the build of evince with introspection support and thus the build of other components in gnome3 that depend on introspection support in evince.
Please switch to calling gtk_style_context_add_provider_for_screen() inside a g_once_init() in your class's _init() (not class_init()) hook.
I'm not really an evince dev. The gtk_style_context_add_provider_for_screen is called inside: static void ev_view_presentation_class_init (EvViewPresentationClass *klass) I presume this is not the right place for calling gtk_style_context_add_provider_for_screen. Should it be assigned to evince?
Created attachment 273142 [details] [review] Patch for ev-view-presentation.c I made a simpe patch that fixes the issue following Colin Walter's suggestion. It is a git format patch.
The attached patch fixes the build for 3.11/3.12 versions of evince.
Review of attachment 273142 [details] [review]: Thanks for the patch. It looks a simple diff, not a git format patch one, I would appreciate a commit message explaining the problem. ::: libview/ev-view-presentation.c @@ +1564,3 @@ + + if (g_once_init_enter (&initialization_value)){ + provider = gtk_css_provider_new (); You can move the GtkCssProvider declaration here too. @@ +1573,3 @@ + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref (provider); + g_once_init_leave (&initialization_value, 42); Why 42? @@ +1574,3 @@ + g_object_unref (provider); + g_once_init_leave (&initialization_value, 42); + } I think this should be called in ev_view_presentation_init() not in ev_view_presentation_new(), to ensure this will be called even when the object is created with g_object_new directly.
Created attachment 273190 [details] [review] Changes proposed to Carlos Garcia Campos in Comment 5
Comment on attachment 273190 [details] [review] Changes proposed to Carlos Garcia Campos in Comment 5 Pushed with some minor style changes, thanks!