Hello Andrea,

last year I reported an issue with Xcircuit on OS X and you found out
it was a Tk 8.6 memory releasing bug.

There's another issue with latest OS X release (10.9) and both
xcircuit and xcircuit-devel, the main window briefly appears and then
the application crashes.

The relevant backtrace is

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libX11.6.dylib                 0x0000000113c82d6b CmapRecForColormap + 98
1   libX11.6.dylib                 0x0000000113c83115 XcmsCCCOfColormap + 31
2   libX11.6.dylib                 0x0000000113c2bf33 XAllocNamedColor + 37
3   xcircuit.so                   0x0000000113bdf9bc CvtStringToPixel + 107
4   xcircuit.so                   0x0000000113bdfa5f xc_alloccolor + 48
5   xcircuit.so                   0x0000000113bd885e build_app_database + 58
6   xcircuit.so                   0x0000000113bd9250 GUI_init + 1304
7   xcircuit.so                   0x0000000113bde010 xctcl_start + 77
8   libtcl8.6.dylib               0x000000010fe85697 TclNRRunCallbacks + 80
9   libtcl8.6.dylib               0x000000010ff0452f SlaveEval + 121
10  libtcl8.6.dylib               0x000000010ff01cfd NRInterpCmd + 1970
11  libtcl8.6.dylib               0x000000010fe85697 TclNRRunCallbacks + 80
12  libtcl8.6.dylib               0x000000010fe868bb TclEvalEx + 1831
13  libtcl8.6.dylib               0x000000010ff17528 Tcl_FSEvalFileEx + 448
14  libtk8.6.dylib                 0x000000010fd518c0 Tk_MainEx + 1143
15  wish                           0x000000010fd2b50f main + 47
16  libdyld.dylib                 0x00007fff889605fd start + 1


Is there anything helpful in tracking down the issue?

It appears to crash on the first call to XAllocNamedColor(), which is
the lowest routine in the stack trace above to be called from inside
xcircuit code.

This would be from xcircuit.c line 743:

   if (XAllocNamedColor(dpy, cmap, (char *)fromVal->addr,
                &cvcolor, &cvexact)
         == 0) {
      ...

Presumably there it is the colormap value "cmap" that is not
initialized.  Back in tclxcircuit.c line 9810, I initialize the cmap
and have a comment about it:

      cmap = Tk_Colormap(tkwind);
      // (The following may be required on some systems where
      // Tk will not report a valid colormap after Tk_MapWindow())
      // cmap = DefaultColormap(dpy, DefaultScreen(dpy));

Try uncommenting line 9813 and see if that helps.  It might be worth
putting that line in an #ifdef for OS X.  Unless there's a way to
force Tk to report a valid colormap.

Since I wrote that line, I thought about it and decided that the
problem must be in the time that it takes X11 to map the window,
which is presumably asynchronous to the xcircuit/Tcl process.  It
may just be a race condition as to whether X11 generates a valid
window first or Tk_Colormap gets called first.

I took a look at the Tk source code where it implements the "tkwait"
command, which basically creates an event handler to wait on X11 to
make the window visible, then deletes the event handler and continues.
I stuck that code into xcircuit version 3.9, where it is currently
updated in the git repository.  I checked that it doesn't break xcircuit
on my system.  If the new version 3.9 works for you, then I'll copy that
code over to xcircuit-3.8 as well.

As usual, the git repository for 3.9 is fixed now;  the tarball will
be available tomorrow.

                                                Regards,
                                                Tim

+--------------------------------+-------------------------------------+
| R. Timothy Edwards (Tim)       | email: t...@opencircuitdesign.com    |
| Open Circuit Design            | web:   http://opencircuitdesign.com |
| 22815 Timber Creek Lane        | phone: (301) 528-5030               |
| Clarksburg, MD 20871-4001      | cell:  (240) 401-0616               |
+--------------------------------+-------------------------------------+
_______________________________________________
Xcircuit-dev mailing list
Xcircuit-dev@opencircuitdesign.com
http://www.opencircuitdesign.com/mailman/listinfo/xcircuit-dev

Reply via email to