Tk Source Code

View Ticket
Login
Ticket UUID: 741179
Title: text-15.* fails to clear font
Type: Bug Version: obsolete: 8.5a0
Submitter: dgp Created on: 2003-05-21 15:12:13
Subsystem: 18. [text] Assigned To: vincentdarley
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-05-27 22:42:05
Resolution: Fixed Closed By: vincentdarley
    Closed on: 2003-05-27 15:42:05
Description:
$ make test TESTFLAGS="-file text.test -match text-15.*"
TCL_LIBRARY=/local/src/tcl/library; export TCL_LIBRARY; \
TK_LIBRARY=/local/src/tk/library; export TK_LIBRARY; \
./tktest /local/src/tk/unix/../tests/all.tcl -geometry
+0+0 \
-file text.test -match text-15.* 
Tests running in interp:  /local/src/tk/solaris/tktest
Tests located in:  /local/src/tk/tests
Tests running in:  /local/src/tk/solaris
Temporary files stored in /local/src/tk/solaris
Test files sourced into current interpreter
Running tests that match:  text-15.*
Skipping test files that match:  l.*.test
Only running test files that match:  text.test
Tests began at Wed May 21 11:11:07 AM EDT 2003
text.test

Tests ended at Wed May 21 11:11:08 AM EDT 2003
all.tcl:        Total   358     Passed  2       Skipped
356     Failed  0
Sourced 2 Test Files.
Font Courier -12 still in cache.


Note the final line.
User Comments: dgp added on 2003-05-22 22:58:33:
Logged In: YES 
user_id=80530


That patch does make the
"still in cache" message go away, yes.

vincentdarley added on 2003-05-22 06:31:28:

File Added - 50944: textpatch.diff

Logged In: YES 
user_id=32170

Yup, one unfortunate side-effect of the new option-
freeing code (Obj-based) is that it actually requires a 
tkwin to operate on.  The old stuff didn't necessarily, 
and it is these changes that are causing this problem, in 
conjunction with a design which overloaded 'textPtr-
>tkwin == NULL' as meaning the widget was being 
deleted.

Anyway, please try the attached patch.

dgp added on 2003-05-22 03:16:20:
Logged In: YES 
user_id=80530

Yes, bugginess in widget destruction is
what I'd expect.  Several Tk widgets
have been through similar troubles.

vincentdarley added on 2003-05-22 02:09:42:
Logged In: YES 
user_id=32170

I imagine the problem is in lines 1346 onwards of 
tkText.c where the widget is destroyed.  If the tkwin 
structure is already null'd out, then the config options 
will not be freed (and therefore the font will not be 
freed).  It looks as if this can happen when called from 
TextCmdDeletedProc, i.e. if the widget command is 
deleted rather than the window being destroyed.

Therefore removing 'textPtr->tkwin = NULL' from 
TextCmdDeletedProc ought to fix this problem, but may 
well create other problems, particularly around double-
deletion of the widget.

Unfortunately, I can't seem to reproduce the problem on 
Windows, so am having a hard time looking into it.

dgp added on 2003-05-21 23:52:39:
Logged In: YES 
user_id=80530


when I revert to the Tk HEAD
of 2003-05-17, the problem
goes away.

The message comes from 
TkFontPkgFree in tkFont.c.

vincentdarley added on 2003-05-21 23:18:00:
Logged In: YES 
user_id=32170

Do you know if this bug was in the old text widget? Also 
can you tell me where that 'still in cache' message 
comes from....

cheers, Vince.

dkf added on 2003-05-21 22:22:18:
Logged In: YES 
user_id=79902

I've not touched that bit at all...

Attachments: