From 0743cef50d06061037169fc8650713fa0c3875b8 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 2 May 2012 06:28:57 +0200 Subject: [PATCH] stylecontext: Disallow adding/removing GtkSettings style providers Adding "system" providers like the GtkSettings object shouldn't be allowed at all, so ensure that it indeed is not. --- gtk/gtkstylecontext.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index ece1b8db0a..1ed5eb4d40 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -43,6 +43,7 @@ #include "gtkstylecascadeprivate.h" #include "gtkstyleproviderprivate.h" #include "gtksettings.h" +#include "gtksettingsprivate.h" /** * SECTION:gtkstylecontext @@ -1237,6 +1238,7 @@ gtk_style_context_add_provider_for_screen (GdkScreen *screen, g_return_if_fail (GDK_IS_SCREEN (screen)); g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider)); + g_return_if_fail (!GTK_IS_SETTINGS (provider) || _gtk_settings_get_screen (GTK_SETTINGS (provider)) == screen); cascade = _gtk_style_cascade_get_for_screen (screen); _gtk_style_cascade_add_provider (cascade, provider, priority); @@ -1259,6 +1261,7 @@ gtk_style_context_remove_provider_for_screen (GdkScreen *screen, g_return_if_fail (GDK_IS_SCREEN (screen)); g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider)); + g_return_if_fail (!GTK_IS_SETTINGS (provider)); cascade = _gtk_style_cascade_get_for_screen (screen); _gtk_style_cascade_remove_provider (cascade, provider);