Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-01-22
08:11 • Ticket [482100ffff] Mac OS X Tk 8-4-a4-1 status still Closed with 2 other ch... artifact: ea91d4ef60 user: wolfsuit
08:11 • Closed ticket [482100ffff]. artifact: 32a81e798d user: wolfsuit
2001-12-22
07:14 • Ticket [482100ffff]: 4 changes artifact: 586160cf69 user: nobody
2001-12-21
05:16 • Open ticket [482100ffff]. artifact: fa92b64e66 user: wolfsuit
04:37 • Ticket [482100ffff]: 4 changes artifact: 4d0e491904 user: nobody
2001-12-20
11:50 • Ticket [482100ffff]: 4 changes artifact: 137dc6cabd user: nobody
06:24 • Pending ticket [482100ffff]. artifact: 1f61b8efc1 user: hobbs
2001-11-15
14:50 • New ticket [482100ffff]. artifact: 0108a98815 user: wobbie

Mac OS X Tk 8-4-a4-1

Closed / Fixed482100ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-11-15 14:50:38
Running a tcl file under Wish Shell results in Segmentation fault 100% re producable.
Running the same tcl file under a compiled version of wish (XonX) works ok.
hobbsplain2001-12-20 06:24:48
Logged In: YES 
user_id=72656

assigning to Jim Ingham, but moved to pending because the 
report doesn't have any details (repro script and such).  
This is likely a better question for the tcl-mac mailing 
list.
nobodyplain2001-12-20 11:50:13
Logged In: NO 

Hi
I will forward the script with details tomorrow.
rob
[email protected]
nobodyplain2001-12-21 04:37:16
Logged In: NO 

Hi Jim 

The actual file is approx 700k.

In order for it to run up there are a series of 
exec statements that have it connect to a digital 
disk device via a network connect. If this fails
you never make it to the gui part.

I have a system setup here and would be more than
happy to run any modified bits of code to better 
understand what's happening. 

If you still feel that you would like to look 
at the tcl file, please let me know where you 
would like me to leave it.

rob
[email protected] 
[email protected]
wolfsuitplain2001-12-21 05:16:13
Logged In: YES 
user_id=169107

Well, what would be great is to get a backtrace for the 
crash, and the Tcl code that is being run at the time of 
the crash.  To get a backtrace, just run the Wish shell 
under gdb, and when it crashes, you can type:

thread apply all bt

Send me that output.  

You can find out what Tcl code is being run by looking 
up the stack for occurances of TclExecuteByteCode, 
and look at codePtr->source in that frame.  The Tcl 
stack mirrors the C stack, so you can reconstruct the 
whole Tcl stack pretty easily this way.

You should be able to chase that fragment back to the 
source proc, and send me that routine.  Also if you can 
tell me how it is being run, is it straight code, button 
callback, menu callback, event binding, etc, that would 
help...  

If it is anything but straight code, you could also send 
along the snippet where it is set up, the bind 
command, or whatever.

I can often figure out what is going on from this info, or 
at least figure out where to put instrumentation to 
chase it down further.

Thanks.
nobodyplain2001-12-22 07:14:00
Logged In: NO 

Hi Jim 
here's the output from gdb 
I will dig a little deeper tomorrow.(chase fragment)
rob
[email protected]
[email protected]

(gdb) run   
Starting program: /Applications/Wish 
Shell.app/Contents/MacOS/./Wish 
Shell /ProntoVideo/Src/pronto_gui.tcl
[Switching to thread 1 (process 4822 thread 0x1603)]
Reading symbols for shared 
libraries ............................................. done

Program received signal EXC_BAD_ACCESS, Could not access 
memory.
0x7000591c in strncpy ()
(gdb) thread apply all bt

Thread 2 (process 4822 thread 0x1f17):
#0  0x70025cac in select ()
#1  0x005e21b0 in NotifierThreadProc (clientData=0x7) at 
tkMacOSXNotify.c:1027
#2  0x70020efc in _pthread_body ()

Thread 1 (process 4822 thread 0x1603):
#0  0x7000591c in strncpy ()
#1  0x0058d784 in Tk_GetFirstTextLayout (layout=0x295d810, 
font=0xbfffc9c8, dst=0xbfffca49 "") 
at ../generic/tkFont.c:3708
#2  0x005e01d0 in ComputeControlTitleParams 
(butPtr=0xbfffca49, paramsPtr=0xbfffca44) at 
tkMacOSXMenubutton.c:555
#3  0x005dfa7c in TkpDisplayMenuButton 
(clientData=0xbfffca49) at tkMacOSXMenubutton.c:231
(gdb)
wolfsuitplain2002-01-22 08:11:31
Logged In: YES 
user_id=169107

This is caused by doing:

button .b -text ""
pack .b

The problem was that we were grabbing the first text 
layout of the button string (the Aqua button CDEF really 
didn't like buttons with newlines in the text).  But we 
didn't handle the case where the text was a null string.

The patch is:

Index: tkFont.c
===========================================
========================
RCS file: /cvsroot/tktoolkit/tk/generic/tkFont.c,v
retrieving revision 1.12.2.1
diff -p -r1.12.2.1 tkFont.c
*** tkFont.c    2001/10/15 09:22:00     1.12.2.1
--- tkFont.c    2002/01/22 01:09:04
*************** Tk_GetFirstTextLayout(
*** 3697,3706 ****
      int numDisplayChars;
  
      layoutPtr = (TextLayout *)layout;
!     if (layoutPtr==NULL) {
!         return 0;
!     }
!     if (layoutPtr->numChunks==0) {
          return 0;
      }
      chunkPtr = layoutPtr->chunks;
--- 3697,3706 ----
      int numDisplayChars;
  
      layoutPtr = (TextLayout *)layout;
!     if ((layoutPtr==NULL)
!             || (layoutPtr->numChunks==0)
!             || (layoutPtr->chunks->numDisplayChars <= 0)) 
{
!         dst[0] = '\0';
          return 0;
      }
      chunkPtr = layoutPtr->chunks;

I checked this in.
wolfsuit Ticket [482100ffff]: 2 changes [History diff]2002-01-22 08:11:32
Log in (anonymous is fine) to add a comment.