diff options
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java | 7 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java index 95dbacff35..ab8460f110 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java @@ -629,11 +629,12 @@ void setForegroundColor (GdkColor color) { public void setImage (Image image) { checkWidget (); if ((style & SWT.ARROW) != 0) return; + if (imageList != null) imageList.dispose (); + imageList = null; if (image != null) { if (image.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - if (imageList == null) imageList = imageList = new ImageList (); - int imageIndex = imageList.indexOf (image); - if (imageIndex == -1) imageIndex = imageList.add (image); + imageList = new ImageList (); + int imageIndex = imageList.add (image); int /*long*/ pixbuf = imageList.getPixbuf (imageIndex); OS.gtk_image_set_from_pixbuf (imageHandle, pixbuf); OS.gtk_widget_hide (labelHandle); 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 9c815a1b5c..c17b7b30b6 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 @@ -464,10 +464,11 @@ public void setImage (Image image) { checkWidget (); if ((style & SWT.SEPARATOR) != 0) return; this.image = image; + if (imageList != null) imageList.dispose (); + imageList = null; if (image != null) { - if (imageList == null) imageList = imageList = new ImageList (); - int imageIndex = imageList.indexOf (image); - if (imageIndex == -1) imageIndex = imageList.add (image); + imageList = new ImageList (); + int imageIndex = imageList.add (image); int /*long*/ pixbuf = imageList.getPixbuf (imageIndex); OS.gtk_image_set_from_pixbuf (imageHandle, pixbuf); OS.gtk_widget_hide (labelHandle); |