Don't assume a screen exists before realize()
Fix for https://bugzilla.gnome.org/show_bug.cgi?id=641429
This commit is contained in:
parent
2b2e607492
commit
4dc9b294d8
@ -819,6 +819,8 @@ _gtk_style_new_for_path (GdkScreen *screen,
|
|||||||
GtkStyle *style;
|
GtkStyle *style;
|
||||||
|
|
||||||
context = gtk_style_context_new ();
|
context = gtk_style_context_new ();
|
||||||
|
|
||||||
|
if (screen)
|
||||||
gtk_style_context_set_screen (context, screen);
|
gtk_style_context_set_screen (context, screen);
|
||||||
gtk_style_context_set_path (context, path);
|
gtk_style_context_set_path (context, path);
|
||||||
|
|
||||||
@ -848,8 +850,7 @@ gtk_style_new (void)
|
|||||||
path = gtk_widget_path_new ();
|
path = gtk_widget_path_new ();
|
||||||
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
|
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
|
||||||
|
|
||||||
style = _gtk_style_new_for_path (gdk_screen_get_default (),
|
style = _gtk_style_new_for_path (gdk_screen_get_default (), path);
|
||||||
path);
|
|
||||||
|
|
||||||
gtk_widget_path_free (path);
|
gtk_widget_path_free (path);
|
||||||
|
|
||||||
|
@ -2617,7 +2617,7 @@ gtk_style_context_set_screen (GtkStyleContext *context,
|
|||||||
GtkStyleContextPrivate *priv;
|
GtkStyleContextPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
|
||||||
|
|
||||||
priv = context->priv;
|
priv = context->priv;
|
||||||
if (priv->screen == screen)
|
if (priv->screen == screen)
|
||||||
|
@ -14179,7 +14179,7 @@ gtk_widget_get_style_context (GtkWidget *widget)
|
|||||||
G_CALLBACK (style_context_changed), widget);
|
G_CALLBACK (style_context_changed), widget);
|
||||||
|
|
||||||
gtk_style_context_set_screen (widget->priv->context,
|
gtk_style_context_set_screen (widget->priv->context,
|
||||||
gtk_widget_get_screen (widget));
|
gtk_widget_get_screen_unchecked (widget));
|
||||||
|
|
||||||
_gtk_widget_update_path (widget);
|
_gtk_widget_update_path (widget);
|
||||||
gtk_style_context_set_path (widget->priv->context,
|
gtk_style_context_set_path (widget->priv->context,
|
||||||
|
@ -1108,6 +1108,7 @@ gtk_window_init (GtkWindow *window)
|
|||||||
priv->has_user_ref_count = TRUE;
|
priv->has_user_ref_count = TRUE;
|
||||||
toplevel_list = g_slist_prepend (toplevel_list, window);
|
toplevel_list = g_slist_prepend (toplevel_list, window);
|
||||||
|
|
||||||
|
if (priv->screen)
|
||||||
g_signal_connect (priv->screen, "composited-changed",
|
g_signal_connect (priv->screen, "composited-changed",
|
||||||
G_CALLBACK (gtk_window_on_composited_changed), window);
|
G_CALLBACK (gtk_window_on_composited_changed), window);
|
||||||
}
|
}
|
||||||
@ -7985,6 +7986,7 @@ gtk_window_set_screen (GtkWindow *window,
|
|||||||
gtk_widget_reset_rc_styles (widget);
|
gtk_widget_reset_rc_styles (widget);
|
||||||
if (screen != previous_screen)
|
if (screen != previous_screen)
|
||||||
{
|
{
|
||||||
|
if (previous_screen)
|
||||||
g_signal_handlers_disconnect_by_func (previous_screen,
|
g_signal_handlers_disconnect_by_func (previous_screen,
|
||||||
gtk_window_on_composited_changed, window);
|
gtk_window_on_composited_changed, window);
|
||||||
g_signal_connect (screen, "composited-changed",
|
g_signal_connect (screen, "composited-changed",
|
||||||
|
Loading…
Reference in New Issue
Block a user