After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 726812 - Introspection fails with evince-3.11.91 and gtk-3.11.8
Introspection fails with evince-3.11.91 and gtk-3.11.8
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.12.x
Other FreeBSD
: Normal critical
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-03-21 08:42 UTC by Gustau Pérez i Querol
Modified: 2014-03-30 10:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for ev-view-presentation.c (2.38 KB, patch)
2014-03-28 07:54 UTC, Gustau Pérez i Querol
needs-work Details | Review
Changes proposed to Carlos Garcia Campos in Comment 5 (2.77 KB, patch)
2014-03-28 17:54 UTC, Gustau Pérez i Querol
committed Details | Review

Description Gustau Pérez i Querol 2014-03-21 08:42:38 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.
Comment 1 Colin Walters 2014-03-21 11:27:41 UTC
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.
Comment 2 Gustau Pérez i Querol 2014-03-21 11:58:41 UTC
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?
Comment 3 Gustau Pérez i Querol 2014-03-28 07:54:59 UTC
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.
Comment 4 Gustau Pérez i Querol 2014-03-28 07:55:25 UTC
The attached patch fixes the build for 3.11/3.12 versions of evince.
Comment 5 Carlos Garcia Campos 2014-03-28 14:41:55 UTC
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.
Comment 6 Gustau Pérez i Querol 2014-03-28 17:54:19 UTC
Created attachment 273190 [details] [review]
Changes proposed to Carlos Garcia Campos in Comment 5
Comment 7 Carlos Garcia Campos 2014-03-30 10:21:02 UTC
Comment on attachment 273190 [details] [review]
Changes proposed to Carlos Garcia Campos in Comment 5 

Pushed with some minor style changes, thanks!