diff options
author | Alexandr Miloslavskiy | 2020-11-16 16:38:17 +0000 |
---|---|---|
committer | Alexandr Miloslavskiy | 2020-11-16 16:39:47 +0000 |
commit | b56bbd2193fe0f8c8ecf5ab0401e5e27da699379 (patch) | |
tree | 2c402a0829b5c5dbbca6fccc4d2cafde889dcd24 | |
parent | 032590f3d0119b3aafb08e3d45276220503e28a6 (diff) | |
download | eclipse.platform.swt-b56bbd2193fe0f8c8ecf5ab0401e5e27da699379.tar.gz eclipse.platform.swt-b56bbd2193fe0f8c8ecf5ab0401e5e27da699379.tar.xz eclipse.platform.swt-b56bbd2193fe0f8c8ecf5ab0401e5e27da699379.zip |
Bug 568861 - [GTK] Gtk-CRITICAL in Label.setFontDescription()
Change-Id: I6b4611a9c56091f72bff1fec87325873f7f37c64
Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java index 0be889c979..97027d9574 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java @@ -585,13 +585,15 @@ void setFontDescription (long font) { if (labelHandle != 0) setFontDescription (labelHandle, font); if (imageHandle != 0) setFontDescription (imageHandle, font); - // Bug 445801: Work around for computeSize not returning a different value after - // changing font, see https://bugzilla.gnome.org/show_bug.cgi?id=753116 - // This updates the pango context and also clears the size request cache on the GTK side. - int originalDirection = (style & SWT.RIGHT_TO_LEFT) != 0 ? GTK.GTK_TEXT_DIR_RTL : GTK.GTK_TEXT_DIR_LTR; - int tempDirection = (style & SWT.RIGHT_TO_LEFT) != 0 ? GTK.GTK_TEXT_DIR_LTR : GTK.GTK_TEXT_DIR_RTL; - GTK.gtk_widget_set_direction (labelHandle, tempDirection); - GTK.gtk_widget_set_direction (labelHandle, originalDirection); + if (labelHandle != 0) { + // Bug 445801: Work around for computeSize not returning a different value after + // changing font, see https://bugzilla.gnome.org/show_bug.cgi?id=753116 + // This updates the pango context and also clears the size request cache on the GTK side. + int originalDirection = (style & SWT.RIGHT_TO_LEFT) != 0 ? GTK.GTK_TEXT_DIR_RTL : GTK.GTK_TEXT_DIR_LTR; + int tempDirection = (style & SWT.RIGHT_TO_LEFT) != 0 ? GTK.GTK_TEXT_DIR_LTR : GTK.GTK_TEXT_DIR_RTL; + GTK.gtk_widget_set_direction (labelHandle, tempDirection); + GTK.gtk_widget_set_direction (labelHandle, originalDirection); + } } @Override |