Tk Source Code

View Ticket
Login
Ticket UUID: 1556406
Title: Unloading of Tk can replace user procedures
Type: Bug Version: obsolete: 8.4.13
Submitter: mpc_janssen Created on: 2006-09-11 14:22:51
Subsystem: 63. Tk_Win Functions Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Open Last Modified: 2006-09-11 23:05:21
Resolution: None Closed By:
    Closed on:
Description:
When Tk gets unloaded (for instance when closing the
toplevel window), the standard widget commands are
replace by the TkDeadAppCmd. This leads to a suprising
result when Tk widget commands have been renamed.
For example:

% package require Tk
8.4
% rename scale tk_scale
% proc scale args {puts "My scale"}
% scale
My scale
% # close toplevel
% scale
can't invoke "scale" command:  application has been
destroyed
% set tcl_patchLevel
8.4.13

Also when invoking the renamed widget command, the
dummy is not invoked as Tk has not redefined the proc:

% tk_scale .s
this isn't a Tk applicationNULL main window
User Comments: dgp added on 2006-09-11 23:05:21:
Logged In: YES 
user_id=80530


FWIW, I'll observe that the
root of this problem is
Tk's legacy assumption that
it's in wish.  These commands
really shouldn't be disabled
like this.  They ought to
survive, throwing errors if
called with no widget tree to
work on, but then working again
after a [toplevel .] creates
a new widget tree.

dkf added on 2006-09-11 21:44:18:
Logged In: YES 
user_id=79902

The correct way of handling this is to store the Tcl_Command
values returned from the Tcl_Create(Obj)Command calls and to
use the token-oriented functions to do the unpicking.