changeset 6424:b6f62f8bd8e6

RT-16923: Toolkit addListener methods should ignore null listeners Reviewed-by: anthony, kcr, fheidric
author vadim
date Wed, 05 Mar 2014 12:48:39 +0400
parents df8841896a28
children b9b901417181
files modules/graphics/src/main/java/com/sun/javafx/tk/Toolkit.java
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/javafx/tk/Toolkit.java	Tue Mar 04 19:02:46 2014 -0800
+++ b/modules/graphics/src/main/java/com/sun/javafx/tk/Toolkit.java	Wed Mar 05 12:48:39 2014 +0400
@@ -357,6 +357,9 @@
         }
     }
     public void addStageTkPulseListener(TKPulseListener listener) {
+        if (listener == null) {
+            return;
+        }
         synchronized (this) {
             AccessControlContext acc = AccessController.getContext();
             stagePulseListeners.put(listener, acc);
@@ -368,6 +371,9 @@
         }
     }
     public void addSceneTkPulseListener(TKPulseListener listener) {
+        if (listener == null) {
+            return;
+        }
         synchronized (this) {
             AccessControlContext acc = AccessController.getContext();
             scenePulseListeners.put(listener, acc);
@@ -379,6 +385,9 @@
         }
     }
     public void addPostSceneTkPulseListener(TKPulseListener listener) {
+        if (listener == null) {
+            return;
+        }
         synchronized (this) {
             AccessControlContext acc = AccessController.getContext();
             postScenePulseListeners.put(listener, acc);
@@ -391,6 +400,9 @@
     }
 
     public void addTkListener(TKListener listener) {
+        if (listener == null) {
+            return;
+        }
         AccessControlContext acc = AccessController.getContext();
         toolkitListeners.put(listener, acc);
     }
@@ -407,6 +419,9 @@
     }
 
     public void addShutdownHook(Runnable hook) {
+        if (hook == null) {
+            return;
+        }
         synchronized (shutdownHooks) {
             shutdownHooks.add(hook);
         }