summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2006-12-05 21:38:33 +0000
committerRoman Kennke <roman@kennke.org>2006-12-05 21:38:33 +0000
commit30a18f5e72b46f6d326367070426458473c244db (patch)
tree919574e7b72fa21d3578ef81ad21ca0098c22339
parent25ca7333af74365be7349b0f7577dbb416f7ab06 (diff)
downloadclasspath-30a18f5e72b46f6d326367070426458473c244db.tar.gz
2006-12-05 Roman Kennke <kennke@aicas.com>
* gnu/java/awt/peer/gtk/AsyncImage.java (addObserver): Check for null and ignore null observers. (getWidth): Check for null and ignore null observers. (getHeight): Check for null and ignore null observers. (getProperty): Check for null and ignore null observers.
-rw-r--r--ChangeLog8
-rw-r--r--gnu/java/awt/peer/gtk/AsyncImage.java42
2 files changed, 35 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 3025571cd..3a43653a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-12-05 Roman Kennke <kennke@aicas.com>
+
+ * gnu/java/awt/peer/gtk/AsyncImage.java
+ (addObserver): Check for null and ignore null observers.
+ (getWidth): Check for null and ignore null observers.
+ (getHeight): Check for null and ignore null observers.
+ (getProperty): Check for null and ignore null observers.
+
2006-12-05 Francis Kung <fkung@redhat.com>
* java/awt/BasicStroke.java
diff --git a/gnu/java/awt/peer/gtk/AsyncImage.java b/gnu/java/awt/peer/gtk/AsyncImage.java
index 855e1d604..81c4db32b 100644
--- a/gnu/java/awt/peer/gtk/AsyncImage.java
+++ b/gnu/java/awt/peer/gtk/AsyncImage.java
@@ -165,9 +165,12 @@ public class AsyncImage
public int getHeight(ImageObserver observer)
{
- synchronized (observers)
+ if (observer != null)
{
- observers.add(observer);
+ synchronized (observers)
+ {
+ observers.add(observer);
+ }
}
int height = 0;
Image r = realImage;
@@ -178,9 +181,12 @@ public class AsyncImage
public Object getProperty(String name, ImageObserver observer)
{
- synchronized (observers)
+ if (observer != null)
{
- observers.add(observer);
+ synchronized (observers)
+ {
+ observers.add(observer);
+ }
}
Image r = realImage;
Object prop = null;
@@ -202,9 +208,12 @@ public class AsyncImage
public int getWidth(ImageObserver observer)
{
- synchronized (observers)
+ if (observer != null)
{
- observers.add(observer);
+ synchronized (observers)
+ {
+ observers.add(observer);
+ }
}
int width = 0;
Image r = realImage;
@@ -215,16 +224,19 @@ public class AsyncImage
void addObserver(ImageObserver obs)
{
- if (realImage != null && ! observers.contains(obs))
- {
- obs.imageUpdate(this, ImageObserver.WIDTH | ImageObserver.HEIGHT
- |ImageObserver.ALLBITS | ImageObserver.PROPERTIES,
- 0, 0, realImage.getWidth(null),
- realImage.getHeight(null));
- }
- synchronized (observers)
+ if (obs != null)
{
- observers.add(obs);
+ if (realImage != null && ! observers.contains(obs))
+ {
+ obs.imageUpdate(this, ImageObserver.WIDTH | ImageObserver.HEIGHT
+ |ImageObserver.ALLBITS | ImageObserver.PROPERTIES,
+ 0, 0, realImage.getWidth(null),
+ realImage.getHeight(null));
+ }
+ synchronized (observers)
+ {
+ observers.add(obs);
+ }
}
}