From ce696a50f14747b6f18af732e0950c05c2ae84fe Mon Sep 17 00:00:00 2001 From: Francisco Tolmasky Date: Tue, 2 Dec 2008 18:08:41 -0800 Subject: [PATCH] Fix for windowShouldClose: being called twice. [#152 state:resolved] Reviewed by me. --- AppKit/CPWindow.j | 11 +++++++++-- Objective-J/exception.js | 6 ++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/AppKit/CPWindow.j b/AppKit/CPWindow.j index ed41510d5..8c7aa7637 100644 --- a/AppKit/CPWindow.j +++ b/AppKit/CPWindow.j @@ -1335,8 +1335,15 @@ CPTexturedBackgroundWindowMask */ - (void)performClose:(id)aSender { - if ([_delegate respondsToSelector:@selector(windowShouldClose:)] && ![_delegate windowShouldClose:self] || - [self respondsToSelector:@selector(windowShouldClose:)] && ![self windowShouldClose:self]) + // Only send ONE windowShouldClose: message. + if ([_delegate respondsToSelector:@selector(windowShouldClose:)]) + { + if (![_delegate windowShouldClose:self]) + return; + } + + // Only check self is delegate does NOT implement this. This also ensures this when delegate == self (returns true). + else if ([self respondsToSelector:@selector(windowShouldClose:)] && ![self windowShouldClose:self]) return; [self close]; diff --git a/Objective-J/exception.js b/Objective-J/exception.js index df317d495..ef0f1b3d5 100644 --- a/Objective-J/exception.js +++ b/Objective-J/exception.js @@ -52,10 +52,8 @@ function objj_exception_setOutputStream(aStream) OBJJ_EXCEPTION_OUTPUT_STREAM = aStream; } -#if COMPILER -importPackage(java.lang); - -objj_exception_setOutputStream(function (aString) { System.out.println(aString) } ); +#if RHINO +objj_exception_setOutputStream(warning_stream); #elif DEBUG if (window.console && window.console.error) objj_exception_setOutputStream(function (aString) { console.error(aString) } );