diff options
-rw-r--r-- | generic/tkText.c | 1 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 33 | ||||
-rw-r--r-- | tests/text.test | 10 | ||||
-rw-r--r-- | win/ttkWinMonitor.c | 11 |
4 files changed, 47 insertions, 8 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index 6ff1db9..e0dcc50 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -1491,6 +1491,7 @@ TextWidgetObjCmd( * Move the insertion position to the correct place. */ + indexFromPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]); TkTextIndexForwChars(NULL, indexFromPtr, deleteInsertOffset, &index, COUNT_INDICES); TkBTreeUnlinkSegment(textPtr->insertMarkPtr, diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 3397f71..5bfcaf1 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -538,7 +538,7 @@ Tk_GetOpenFileObjCmd( if (len) { filename = [[[NSString alloc] initWithUTF8String:str] autorelease]; - [openpanel setNameFieldStringValue:filename]; + [openpanel setNameFieldStringValue:filename]; } break; case OPEN_MESSAGE: @@ -662,7 +662,12 @@ Tk_GetOpenFileObjCmd( if (directory) { [openpanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } + /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/ + if (filename) { [openpanel setNameFieldStringValue:filename]; + } else { + [openpanel setNameFieldStringValue:@""]; + } [openpanel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:openpanel @@ -678,7 +683,13 @@ Tk_GetOpenFileObjCmd( if (directory) { [openpanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } - [openpanel setNameFieldStringValue:filename]; + /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/ + if (filename) { + [openpanel setNameFieldStringValue:filename]; + } else { + [openpanel setNameFieldStringValue:@""]; + } + modalReturnCode = [openpanel runModal]; #endif [NSApp tkFilePanelDidEnd:openpanel returnCode:modalReturnCode @@ -898,7 +909,12 @@ Tk_GetSaveFileObjCmd( if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } - [savepanel setNameFieldStringValue:filename]; + /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/ + if (filename) { + [savepanel setNameFieldStringValue:filename]; + } else { + [savepanel setNameFieldStringValue:@""]; + } [savepanel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:savepanel @@ -913,7 +929,12 @@ Tk_GetSaveFileObjCmd( if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } - [savepanel setNameFieldStringValue:filename]; + /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/ + if (filename) { + [savepanel setNameFieldStringValue:filename]; + } else { + [savepanel setNameFieldStringValue:@""]; + } modalReturnCode = [savepanel runModal]; #if 0 NSLog(@"modal: %li", modalReturnCode); @@ -1047,6 +1068,10 @@ Tk_ChooseDirectoryObjCmd( callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; + /*check for directory value, set to root if not specified; otherwise crashes with exception because of nil string parameter*/ + if (!directory) { + directory = @"/"; + } parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; diff --git a/tests/text.test b/tests/text.test index edd2a6e..42b6114 100644 --- a/tests/text.test +++ b/tests/text.test @@ -1577,6 +1577,16 @@ test text-8.26 {TextWidgetCmd procedure, "replace" option crash} -setup { } -cleanup { destroy .tt } -result {} +test text-8.27 {TextWidgetCmd procedure, "replace" option crash} -setup { + text .tt +} -body { + .tt insert 0.0 \na + for {set i 0} {$i < 2} {incr i} { + .tt replace 2.0 3.0 b + } +} -cleanup { + destroy .tt +} -result {} test text-9.1 {TextWidgetCmd procedure, "get" option} -setup { diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c index c6e906b..6e46374 100644 --- a/win/ttkWinMonitor.c +++ b/win/ttkWinMonitor.c @@ -122,12 +122,15 @@ WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) case WM_THEMECHANGED: /* - * Reset the application theme to 'xpnative' if present, - * which will in turn fall back to 'winnative' if XP theming - * is disabled. + * Reset the application theme. + * On windows, it is possible to sign in as a second user, change + * the theme to 'winnative' (by setting the ui to 'best performance'), + * which is a machine-wide change, and then sign back on to the original user. + * Ttk_UseTheme needs to be executed again in order to process the fallback + * from vista/xpnative to winnative. */ - theme = Ttk_GetTheme(interp, "xpnative"); + theme = Ttk_GetCurrentTheme(interp); if (theme) { Ttk_UseTheme(interp, theme); /* @@@ What to do about errors here? */ |