summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2017-07-28 18:38:15 (GMT)
committerdgp <dgp@users.sourceforge.net>2017-07-28 18:38:15 (GMT)
commit1893021a437d49db7a82422c41206aeb011ef3c4 (patch)
tree3276604b93c10095478ad1085030bd5b2fedbe59
parent8aecb568ca2896cfae4253ead2fe62442d977b55 (diff)
parenta2d0ee1d83897b9b5d95ea1e6182cdc2448e9425 (diff)
downloadtk-1893021a437d49db7a82422c41206aeb011ef3c4.zip
tk-1893021a437d49db7a82422c41206aeb011ef3c4.tar.gz
tk-1893021a437d49db7a82422c41206aeb011ef3c4.tar.bz2
merge 8.6
-rw-r--r--generic/tkText.c1
-rw-r--r--macosx/tkMacOSXDialog.c33
-rw-r--r--tests/text.test10
-rw-r--r--win/ttkWinMonitor.c11
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? */