[gtk+] stylecontext: Disallow adding/removing GtkSettings style providers



commit 0743cef50d06061037169fc8650713fa0c3875b8
Author: Benjamin Otte <otte redhat com>
Date:   Wed May 2 06:28:57 2012 +0200

    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 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index ece1b8d..1ed5eb4 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]