Skip to content

Commit

Permalink
Fix a crash during the build with introspection enabled
Browse files Browse the repository at this point in the history
Using GI_SCANNER_DEBUG=save-temps, the temporal files remained.
It has been suggested that calling gtk_style_context_add_provider_for_screen()
should, inside a g_once_init(), be in the class's _init() (not class_init()) hook.

https://bugzilla.gnome.org/show_bug.cgi?id=726812
  • Loading branch information
Gustau Perez authored and Carlos Garcia Campos committed Mar 30, 2014
1 parent aa1decf commit a203fc1
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions libview/ev-view-presentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,6 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkBindingSet *binding_set;
GtkCssProvider *provider;

klass->change_page = ev_view_presentation_change_page;

Expand Down Expand Up @@ -1533,23 +1532,30 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
gtk_binding_entry_add_signal (binding_set, GDK_KEY_K, 0,
"change_page", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_BACKWARD);

provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,
"EvViewPresentation {\n"
" background-color: black; }",
-1, NULL);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
}

static void
ev_view_presentation_init (EvViewPresentation *pview)
{
static gsize initialization_value = 0;

gtk_widget_set_can_focus (GTK_WIDGET (pview), TRUE);
pview->is_constructing = TRUE;

if (g_once_init_enter (&initialization_value)) {
GtkCssProvider *provider;

provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,
"EvViewPresentation {\n"
" background-color: black; }",
-1, NULL);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
g_once_init_leave (&initialization_value, 1);
}
}

GtkWidget *
Expand Down

0 comments on commit a203fc1

Please sign in to comment.