diff options
| -rw-r--r-- | changes.md | 1 | ||||
| -rw-r--r-- | win/tkWin32Dll.c | 46 |
2 files changed, 29 insertions, 18 deletions
@@ -39,6 +39,7 @@ to the userbase. - [tk print, canvas: raw smooth not implemented](https://core.tcl-lang.org/tk/info/e10819) - [Aqua: avoid use-after-free during RefocusGrabWindow()](https://core.tcl-lang.org/tk/info/6da885) - [Aqua: ttk::notebook tabs](https://core.tcl-lang.org/tk/info/cf296a) + - [Fix crash on exit due to faulty asm code in DllMain](https://core.tcl-lang.org/tk/info/44b34c) Release Tk 9.0.2 arises from the check-in with tag `core-9-0-2`. diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index fa8839c..c6209da 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -149,13 +149,21 @@ DllMain( "movq %%rdx, %%gs:0" "\n\t" - /* - * Call TkFinalize - */ + : + /* No outputs */ + : + [registration] "m" (registration), + [error] "i" (TCL_ERROR) + : + "%rax", "%rdx", "memory" + ); - "movq $0x0, 0x0(%%rsp)" "\n\t" - "call TkFinalize" "\n\t" + /* Just do a regular C call so we don't need to worry about following + * the calling convention, specially the registers the function may + * clobber: */ + TkFinalize(NULL); + __asm__ __volatile__ ( /* * Come here on a normal exit. Recover the TCLEXCEPTION_REGISTRATION * and store a TCL_OK status @@ -189,11 +197,9 @@ DllMain( : /* No outputs */ : - [registration] "m" (registration), - [ok] "i" (TCL_OK), - [error] "i" (TCL_ERROR) + [ok] "i" (TCL_OK) : - "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", "memory" + "%rax", "%rdx", "memory" ); # else @@ -219,12 +225,18 @@ DllMain( "movl %%edx, %%fs:0" "\n\t" - /* - * Call TkFinalize - */ + : + /* No outputs */ + : + [registration] "m" (registration), + [error] "i" (TCL_ERROR) + : + "%eax", "%ebx", "%edx", "memory" + ); + + TkFinalize(NULL); - "movl $0x0, 0x0(%%esp)" "\n\t" - "call _TkFinalize" "\n\t" + __asm__ __volatile__ ( /* * Come here on a normal exit. Recover the TCLEXCEPTION_REGISTRATION @@ -260,11 +272,9 @@ DllMain( : /* No outputs */ : - [registration] "m" (registration), - [ok] "i" (TCL_OK), - [error] "i" (TCL_ERROR) + [ok] "i" (TCL_OK) : - "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory" + "%eax", "%ebx", "%edx", "memory" ); # endif |
