You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2022/03/09 01:34:47 UTC

[royale-asjs] 02/02: Fix in EventDispatcher : re-dispatching an Event should automatically clone the original Event, because target (after it is initially set the first time) is immutable.

This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 88c72e1785067c8a4da2035d772466333dc55006
Author: greg-dove <gr...@gmail.com>
AuthorDate: Wed Mar 9 14:31:14 2022 +1300

    Fix in EventDispatcher : re-dispatching an Event should automatically clone the original Event, because target (after it is initially set the first time) is immutable.
---
 .../Core/src/main/royale/org/apache/royale/events/EventDispatcher.as | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as
index 30dbd67..d3b9bca 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/EventDispatcher.as
@@ -85,6 +85,11 @@ package org.apache.royale.events
 					//console.log("created event from string ",event);
 				}
 				else if ("target" in event1) {
+					if (event1.target && 'cloneEvent' in event1) {
+						//we are re-dispatching, we need to clone the original:
+						event1 = event1.cloneEvent();
+					}
+
 					event1.target = _dispatcher;
 					//console.log("assigned target to event ",event);
 				}