summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-08-06 15:27:43 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-08-06 15:27:43 (GMT)
commitd3a2a48d8d9a19d934337117c18de3084225b7eb (patch)
treee5bf7182f902b17a4b74ab33befeb26fdc43ff4b
parent67481f6306a54cf170cfb2c2e414ce8cf0a6ba9f (diff)
parent03a506ce3f8f464dd35f15e01795f639bd26d7fa (diff)
downloadtk-d3a2a48d8d9a19d934337117c18de3084225b7eb.zip
tk-d3a2a48d8d9a19d934337117c18de3084225b7eb.tar.gz
tk-d3a2a48d8d9a19d934337117c18de3084225b7eb.tar.bz2
merge trunk
-rw-r--r--generic/tkText.c1
-rw-r--r--library/menu.tcl1
-rw-r--r--macosx/tkMacOSXDialog.c33
-rw-r--r--tests/text.test10
-rw-r--r--win/ttkWinMonitor.c11
5 files changed, 48 insertions, 8 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 4f25222..ba1e9ab 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/library/menu.tcl b/library/menu.tcl
index b5dd88e..e1c94c9 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -170,6 +170,7 @@ bind Menu <<NextLine>> {
}
bind Menu <KeyPress> {
tk::TraverseWithinMenu %W %A
+ break
}
# The following bindings apply to all windows, and are used to
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 50db250..17eb79c 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -1589,6 +1589,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? */