Tk Source Code

View Ticket
Login
Ticket UUID: 891141
Title: Entry/Leave events cause variable writes
Type: Bug Version: obsolete: 8.4.13
Submitter: speedboat Created on: 2004-02-05 16:38:26
Subsystem: 15. [scale] Assigned To: dgp
Priority: 6 Severity:
Status: Closed Last Modified: 2006-06-15 05:16:59
Resolution: Fixed Closed By: dgp
    Closed on: 2006-06-14 22:16:58
Description:
I've report a similiar problem, which was LINUX specific 
and eventually blamed on the compiler. This time, it 
occurs on multiple platforms.

If a trace is set up to watch writes to a variable, and 
the variable is also used as the -variable parameter to a 
scale widget, the variable gets written, even though it's 
contents remains unchanged, during Leave and Enter 
events (NOTE: Depends on value, for example 3.5 is OK, 
but 3.4 causes a variable write on all Leave/Enters)

I've attached an example.
User Comments: dgp added on 2006-06-15 05:16:59:

File Added - 181677: 891141.patch

dgp added on 2006-06-15 05:16:58:
Logged In: YES 
user_id=80530

committing attached patch
for 8.4.14 and 8.5a5

hobbs added on 2006-03-31 14:17:17:
Logged In: YES 
user_id=72656

OK, I think we can chalk this one up to TkRoundToResolution,
but what to do about it?  You can very easily see why the
problem exists here:

(tk85d) 2 % set tcl_precision 17
17
(tk85d) 3 % expr 3.5-0.1
3.3999999999999999
(tk85d) 4 % expr 3.6-0.1
3.5

So when we internally store "3.4" into the scale value as a
double, it's not /really/ 3.4, so each time we "Round" it,
it is seen as changed.

This affects 8.4.13 and 8.5a4.

dgp added on 2004-02-06 23:52:53:
Logged In: YES 
user_id=80530


just a note that similar issues
in the past have come down to
numeric precision issues in
TkRoundToResolution.

hobbs added on 2004-02-06 00:31:47:
Logged In: YES 
user_id=72656

Confirmed on WinXP with 8.4.5 - 3.5 OK, 3.4 causes write on
enter/leave.

speedboat added on 2004-02-05 23:38:33:

File Added - 75804: test.tcl

Attachments: