summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2005-05-06 21:54:28 +0000
committerFelipe Heidrich <fheidric>2005-05-06 21:54:28 +0000
commit2a99b12f3f121573f6a87579f2b9aa6f85abbe1b (patch)
tree1ccae11726d1bfda84c3262c36b1f503f900ddc9
parent285048d733ba2ac7ac939aae339235bf286f43d0 (diff)
downloadeclipse.platform.swt-2a99b12f3f121573f6a87579f2b9aa6f85abbe1b.tar.gz
eclipse.platform.swt-2a99b12f3f121573f6a87579f2b9aa6f85abbe1b.tar.xz
eclipse.platform.swt-2a99b12f3f121573f6a87579f2b9aa6f85abbe1b.zip
94003
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java7
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);