diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-11-09 15:44:24 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-11-09 15:44:24 (GMT) |
commit | 9eb72f5e699be0285d04f0408799b0a70144213e (patch) | |
tree | 0de6a8886d3712b0093d2b9ee8bd22ab9838934c | |
parent | 64ca20bda46c8101f58052d41e9d2b1ac534bd77 (diff) | |
parent | 012e0eb64e8ed4ffacb5a92a8946201ce45e5ac1 (diff) | |
download | tk-9eb72f5e699be0285d04f0408799b0a70144213e.zip tk-9eb72f5e699be0285d04f0408799b0a70144213e.tar.gz tk-9eb72f5e699be0285d04f0408799b0a70144213e.tar.bz2 |
Fix [5ee8af61e5ef8e233158a43459624f4ecf58a6fe|5ee8af61e5] on Unix: Window embedding can not work on 64-bit Unix and Windows
-rw-r--r-- | unix/tkUnixEmbed.c | 5 | ||||
-rw-r--r-- | unix/tkUnixXId.c | 20 |
2 files changed, 17 insertions, 8 deletions
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c index 7f3f94b..b170ad0 100644 --- a/unix/tkUnixEmbed.c +++ b/unix/tkUnixEmbed.c @@ -101,7 +101,7 @@ TkpUseWindow( { TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *usePtr; - int id, anyError; + int anyError; Window parent; Tk_ErrorHandler handler; Container *containerPtr; @@ -115,10 +115,9 @@ TkpUseWindow( Tcl_SetErrorCode(interp, "TK", "EMBED", "POST_CREATE", NULL); return TCL_ERROR; } - if (Tcl_GetInt(interp, string, &id) != TCL_OK) { + if (TkpScanWindowId(interp, string, &parent) != TCL_OK) { return TCL_ERROR; } - parent = (Window) id; usePtr = (TkWindow *) Tk_IdToWindow(winPtr->display, parent); if (usePtr != NULL && !(usePtr->flags & TK_CONTAINER)) { diff --git a/unix/tkUnixXId.c b/unix/tkUnixXId.c index 819b7aa..668f228 100644 --- a/unix/tkUnixXId.c +++ b/unix/tkUnixXId.c @@ -125,13 +125,23 @@ TkpScanWindowId( const char *string, Window *idPtr) { - int value; + int code; + Tcl_Obj obj; - if (Tcl_GetInt(interp, string, &value) != TCL_OK) { - return TCL_ERROR; + obj.refCount = 1; + obj.bytes = (char *) string; /* DANGER?! */ + obj.length = strlen(string); + obj.typePtr = NULL; + + code = Tcl_GetLongFromObj(interp, &obj, (long *)idPtr); + + if (obj.refCount > 1) { + Tcl_Panic("invalid sharing of Tcl_Obj on C stack"); + } + if (obj.typePtr && obj.typePtr->freeIntRepProc) { + obj.typePtr->freeIntRepProc(&obj); } - *idPtr = (Window) value; - return TCL_OK; + return code; } /* |