8015303: [macosx] Application launched via custom URL Scheme does not receive URL
authoranthony
Thu, 30 May 2013 18:10:26 +0400
changeset 17891 706fb153f43d
parent 17689 c6db20805a87
child 17892 b330b424a882
8015303: [macosx] Application launched via custom URL Scheme does not receive URL Summary: Make copies of event parameters Reviewed-by: anthony, swingler, serb Contributed-by: James Tomson <james.b.tomson@gmail.com>
jdk/src/macosx/native/sun/osxapp/QueuingApplicationDelegate.m
--- a/jdk/src/macosx/native/sun/osxapp/QueuingApplicationDelegate.m	Wed May 29 18:40:02 2013 +0400
+++ b/jdk/src/macosx/native/sun/osxapp/QueuingApplicationDelegate.m	Thu May 30 18:10:26 2013 +0400
@@ -110,8 +110,14 @@
 
 - (void)_handleOpenURLEvent:(NSAppleEventDescriptor *)openURLEvent withReplyEvent:(NSAppleEventDescriptor *)replyEvent
 {
+    // Make an explicit copy of the passed events as they may be invalidated by the time they're processed
+    NSAppleEventDescriptor *openURLEventCopy = [openURLEvent copy];
+    NSAppleEventDescriptor *replyEventCopy = [replyEvent copy];
+
     [self.queue addObject:[^(){
-        [self.realDelegate _handleOpenURLEvent:openURLEvent withReplyEvent:replyEvent];
+        [self.realDelegate _handleOpenURLEvent:openURLEventCopy withReplyEvent:replyEventCopy];
+        [openURLEventCopy release];
+        [replyEventCopy release];
     } copy]];
 }