Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Wagiaalla2014-10-01 17:48:42 +0000
committerAlexander Kurtakov2014-10-07 12:51:50 +0000
commitf838d3b1c4f93ae474482feedc7badbe40de61bc (patch)
treeb44a6c176929863bd79aba3b63afb9243a3b844d
parent5630a091774a79a8abc13251bc46b8a2be1f6f8c (diff)
downloadeclipse.platform.swt-f838d3b1c4f93ae474482feedc7badbe40de61bc.tar.gz
eclipse.platform.swt-f838d3b1c4f93ae474482feedc7badbe40de61bc.tar.xz
eclipse.platform.swt-f838d3b1c4f93ae474482feedc7badbe40de61bc.zip
Bug 195337 - Check gtk widget style initialization.I20141008-1300I20141007-1500
Sometimes wigets do not have an initialized style object despite the widget being realized. In that case it makes sense to return an uninitialized GdkColor object. Change-Id: I4e1923f4cfe386e96968dbab93bf9214add793a3 Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 2919e2f7ba..7a4339a747 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -2555,7 +2555,12 @@ GdkColor getBgColor () {
long /*int*/ fontHandle = fontHandle ();
OS.gtk_widget_realize (fontHandle);
GdkColor color = new GdkColor ();
- OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
+
+ long /*int*/ style = OS.gtk_widget_get_style (fontHandle);
+ if (style != 0){
+ OS.gtk_style_get_bg (style, OS.GTK_STATE_NORMAL, color);
+ }
+
return color;
}
@@ -2702,7 +2707,11 @@ GdkColor getFgColor () {
long /*int*/ fontHandle = fontHandle ();
OS.gtk_widget_realize (fontHandle);
GdkColor color = new GdkColor ();
- OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
+
+ long /*int*/ style = OS.gtk_widget_get_style (fontHandle);
+ if (style != 0){
+ OS.gtk_style_get_fg (style, OS.GTK_STATE_NORMAL, color);
+ }
return color;
}

Back to the top