diff options
author | Kevin Walzer <kw@codebykevin.com> | 2020-08-24 00:47:42 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2020-08-24 00:47:42 (GMT) |
commit | 79cce61253647cf934c292ae7c32c133c4cff51e (patch) | |
tree | da705311dd3c70ab67a614918ef36ec8a4596a52 /macosx/tkMacOSXHLEvents.c | |
parent | 4d8366f3ea29283c2698ea9a951c02e50c0e8fac (diff) | |
download | tk-79cce61253647cf934c292ae7c32c133c4cff51e.zip tk-79cce61253647cf934c292ae7c32c133c4cff51e.tar.gz tk-79cce61253647cf934c292ae7c32c133c4cff51e.tar.bz2 |
Test branch for AppleScript bugs with patch from Lars Helstrom
Diffstat (limited to 'macosx/tkMacOSXHLEvents.c')
-rw-r--r-- | macosx/tkMacOSXHLEvents.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index d15abde..91d7b72 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -309,6 +309,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, data, actual, NULL)) { + data[actual] = '\0'; AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); Tcl_DString *scriptTextCommand = &AEInfo->command; Tcl_DStringInit(scriptTextCommand); @@ -383,9 +384,6 @@ static void ProcessAppleEvent( } code = Tcl_EvalEx(AEInfo->interp, Tcl_DStringValue(&AEInfo->command), Tcl_DStringLength(&AEInfo->command), TCL_EVAL_GLOBAL); - if (code != TCL_OK) { - Tcl_BackgroundException(AEInfo->interp, code); - } if (AEInfo->replyEvent && code >= 0) { int reslen; @@ -400,7 +398,10 @@ static void ProcessAppleEvent( AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], keyErrorNumber, typeSInt32, (Ptr) &code, sizeof(int)); } + } else if (code != TCL_OK) { + Tcl_BackgroundException(AEInfo->interp, code); } + Tcl_DStringFree(&AEInfo->command); ckfree(clientData); } |