RTimothyEdwards / XCircuit

XCircuit circuit drawing and schematic capture tool
GNU General Public License v2.0
97 stars 25 forks source link

Xcircuit immediately seg faults after launch #10

Open syfluqs opened 3 years ago

syfluqs commented 3 years ago

Following is my system configuration (Arch linux)

$ uname -a
Linux arc 5.10.7-arch1-1 #1 SMP PREEMPT Wed, 13 Jan 2021 12:02:01 +0000 x86_64 GNU/Linux

and package versions

local/tcl 8.6.11-1
    The Tcl scripting language
local/tcllib 1.19-1
    Set of pure-Tcl extensions.
local/tk 8.6.11.1-1
    A windowing toolkit for use with tcl
local/cairo 1.17.4-3
    2D graphics library with support for multiple output devices
local/lib32-libx11 1.7.0-1
    X11 client-side library (32-bit)
local/libx11 1.7.0-3
    X11 client-side library
local/xcircuit 3.10.28-1
    A program for drawing publishable-quality electrical circuit schematic diagrams

Upon running xcircuit from the terminal, it shows the gui and immediately crashes without any error messages, just this

[1]    1391935 segmentation fault (core dumped)  xcircuit
RTimothyEdwards commented 3 years ago

You can run (depending on where xcircuit is installed) "gdb /usr/local/lib/xcircuit-3.10/xcircexec", followed by "run", and then when/if it segfaults, type "bt" to get a backtrace. That will help me figure out what's going on.

syfluqs commented 3 years ago

This is what I get with gdb

(gdb) set pagination off
(gdb) run
Starting program: /usr/lib/xcircuit-3.10/xcircexec 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff680e640 (LWP 330848)]
Starting xcircuit under Tcl interpreter

Thread 1 "xcircexec" received signal SIGSEGV, Segmentation fault.
0x00007ffff7763672 in XQueryPointer () from /usr/lib/libX11.so.6
(gdb) bt
#0  0x00007ffff7763672 in XQueryPointer () from /usr/lib/libX11.so.6
#1  0x00007ffff6e4f4ad in ?? () from /usr/lib/xcircuit-3.10/xcircuit.so
#2  0x00007ffff6e4f519 in ?? () from /usr/lib/xcircuit-3.10/xcircuit.so
#3  0x00007ffff6e8fb34 in ?? () from /usr/lib/xcircuit-3.10/xcircuit.so
#4  0x00007ffff6eb0a49 in ?? () from /usr/lib/xcircuit-3.10/xcircuit.so
#5  0x00007ffff7dcbc62 in TclNRRunCallbacks () from /usr/lib/libtcl8.6.so
#6  0x00007ffff7dcdb3a in TclEvalEx () from /usr/lib/libtcl8.6.so
#7  0x00007ffff7dce363 in Tcl_EvalEx () from /usr/lib/libtcl8.6.so
#8  0x00007ffff7c5edb1 in Tk_BindEvent () from /usr/lib/libtk8.6.so
#9  0x00007ffff7c63a95 in TkBindEventProc () from /usr/lib/libtk8.6.so
#10 0x00007ffff7c6bc35 in Tk_HandleEvent () from /usr/lib/libtk8.6.so
#11 0x00007ffff7c6be51 in WindowEventProc () from /usr/lib/libtk8.6.so
#12 0x00007ffff7e95fda in Tcl_ServiceEvent () from /usr/lib/libtcl8.6.so
#13 0x00007ffff7e96257 in Tcl_DoOneEvent () from /usr/lib/libtcl8.6.so
#14 0x00007ffff6eb253c in ?? () from /usr/lib/xcircuit-3.10/xcircuit.so
#15 0x00007ffff6eb2abd in ?? () from /usr/lib/xcircuit-3.10/xcircuit.so
#16 0x00007ffff7dcbc62 in TclNRRunCallbacks () from /usr/lib/libtcl8.6.so
#17 0x00007ffff7dcdb3a in TclEvalEx () from /usr/lib/libtcl8.6.so
#18 0x00007ffff7e8836a in Tcl_FSEvalFileEx () from /usr/lib/libtcl8.6.so
#19 0x00007ffff7e8850a in Tcl_EvalFile () from /usr/lib/libtcl8.6.so
#20 0x00007ffff7e8fed5 in Tcl_SourceRCFile () from /usr/lib/libtcl8.6.so
#21 0x00007ffff7c7b4f6 in Tk_MainEx () from /usr/lib/libtk8.6.so
#22 0x00005555555551ea in ?? ()
#23 0x00007ffff7a83152 in __libc_start_main () from /usr/lib/libc.so.6
#24 0x000055555555504e in ?? ()
RTimothyEdwards commented 3 years ago

Does "ldd /bin/wish" include "libX11" in the output? This looks like Tk isn't compiled for X11, which is something that is common on a Mac or on Windows, but I'm not used to seeing it on Linux.

syfluqs commented 3 years ago

yes it does

$ ldd /bin/wish | grep X11
    libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f2f50183000)

Here is the full output also, if that is of any use

$ ldd /bin/wish 
    linux-vdso.so.1 (0x00007ffc45171000)
    libtk8.6.so => /usr/lib/libtk8.6.so (0x00007f372948d000)
    libtcl8.6.so => /usr/lib/libtcl8.6.so (0x00007f37292cd000)
    libc.so.6 => /usr/lib/libc.so.6 (0x00007f3729104000)
    libXft.so.2 => /usr/lib/libXft.so.2 (0x00007f37290eb000)
    libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f37290a0000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f3728f5f000)
    libXss.so.1 => /usr/lib/libXss.so.1 (0x00007f3728f58000)
    libm.so.6 => /usr/lib/libm.so.6 (0x00007f3728e12000)
    libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f3728e0c000)
    libz.so.1 => /usr/lib/libz.so.1 (0x00007f3728df2000)
    libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f3728dd0000)
    /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f3729678000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f3728cfc000)
    libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f3728ced000)
    libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f3728cbe000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f3728c94000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f3728c7f000)
    libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f3728c6c000)
    libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f3728c35000)
    libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007f3728b5f000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f3728b5a000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f3728b52000)
    libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007f3728b2d000)
    libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f37289f9000)
    libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f3728985000)
syfluqs commented 3 years ago

Today I noticed that xcircuit runs fine on my machine if I change the window manager. The segmentation fault appears only when using awesomewm titling window manager. This is peculiar because I also use magic (the layout tool which also has a GUI and uses Tcl/Tk) and it runs fine on awesomewm. So I guess, somewhere xcircuit is trying to access through a pointer to a X11 window property or something and my window manager doesn't provide/instantiate it.

Also, the segmentation fault occurs right after the xcircuit window acquires focus.

I hope this is something to go on for further investigation.

RTimothyEdwards commented 3 years ago

I just pushed a likely fix to the master repo at opencircuitdesign.com (version 3.10.34). Please give it a try and let me know if it works or not.

syfluqs commented 3 years ago

still segfaults, but the backtrace has changed

(gdb) run
Starting program: /usr/lib/xcircuit-3.10/xcircexec 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
XCOps(scale) set to 1
[New Thread 0x7ffff48bb640 (LWP 626597)]
Starting xcircuit under Tcl interpreter

Thread 1 "xcircexec" received signal SIGSEGV, Segmentation fault.
0x00007ffff7978672 in XQueryPointer () from /usr/lib/libX11.so.6
(gdb) bt
#0  0x00007ffff7978672 in XQueryPointer () from /usr/lib/libX11.so.6
#1  0x00007ffff4d35848 in UGetCursor () at functions.c:782
#2  0x00007ffff4d358b2 in UGetCursorPos () at functions.c:811
#3  0x00007ffff4d75230 in make_new_event (event=0x7fffffffc480) at tclxcircuit.c:265
#4  0x00007ffff4d957b2 in xctcl_standardaction (clientData=0x5555555dee20, interp=0x555555598d30, objc=4, objv=0x55555559d560) at tclxcircuit.c:9454
#5  0x00007ffff7e44c62 in TclNRRunCallbacks () from /usr/lib/libtcl8.6.so
#6  0x00007ffff7e46b3a in TclEvalEx () from /usr/lib/libtcl8.6.so
#7  0x00007ffff7e47363 in Tcl_EvalEx () from /usr/lib/libtcl8.6.so
#8  0x00007ffff7cd7db1 in Tk_BindEvent () from /usr/lib/libtk8.6.so
#9  0x00007ffff7cdca95 in TkBindEventProc () from /usr/lib/libtk8.6.so
#10 0x00007ffff7ce4c35 in Tk_HandleEvent () from /usr/lib/libtk8.6.so
#11 0x00007ffff7ce4e51 in WindowEventProc () from /usr/lib/libtk8.6.so
#12 0x00007ffff7f0efda in Tcl_ServiceEvent () from /usr/lib/libtcl8.6.so
#13 0x00007ffff7f0f257 in Tcl_DoOneEvent () from /usr/lib/libtcl8.6.so
#14 0x00007ffff4d97274 in GUI_init (objc=1, objv=0x55555559d298) at tclxcircuit.c:10050
#15 0x00007ffff4d977dd in xctcl_start (clientData=0x5555555dee20, interp=0x555555598d30, objc=1, objv=0x55555559d298) at tclxcircuit.c:10175
#16 0x00007ffff7e44c62 in TclNRRunCallbacks () from /usr/lib/libtcl8.6.so
#17 0x00007ffff7e46b3a in TclEvalEx () from /usr/lib/libtcl8.6.so
#18 0x00007ffff7f0136a in Tcl_FSEvalFileEx () from /usr/lib/libtcl8.6.so
#19 0x00007ffff7f0150a in Tcl_EvalFile () from /usr/lib/libtcl8.6.so
#20 0x00007ffff7f08ed5 in Tcl_SourceRCFile () from /usr/lib/libtcl8.6.so
#21 0x00007ffff7cf44f6 in Tk_MainEx () from /usr/lib/libtk8.6.so
#22 0x0000555555555263 in main (argc=1, argv=0x7fffffffd848) at xcircexec.c:76

If I deliberately hard code the position returned from UGetCursor() and comment out everything else (XQueryPointer calls), I get

(gdb) run
Starting program: /usr/lib/xcircuit-3.10/xcircexec 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
XCOps(scale) set to 1
[New Thread 0x7ffff48bb640 (LWP 636415)]
Starting xcircuit under Tcl interpreter

Thread 1 "xcircexec" received signal SIGSEGV, Segmentation fault.
0x00007ffff79cffc4 in XkbLookupKeySym () from /usr/lib/libX11.so.6
(gdb) bt
#0  0x00007ffff79cffc4 in XkbLookupKeySym () from /usr/lib/libX11.so.6
#1  0x00007ffff79d0981 in XLookupString () from /usr/lib/libX11.so.6
#2  0x00007ffff4d05fb8 in getkeysignature (event=0x7fffffffc480) at events.c:2402
#3  0x00007ffff4d06325 in keyhandler (w=0x0, clientdata=0x0, event=0x7fffffffc480) at events.c:2510
#4  0x00007ffff4d9577d in xctcl_standardaction (clientData=0x5555555dee20, interp=0x555555598d30, objc=4, objv=0x55555559d560) at tclxcircuit.c:9492
#5  0x00007ffff7e44c62 in TclNRRunCallbacks () from /usr/lib/libtcl8.6.so
#6  0x00007ffff7e46b3a in TclEvalEx () from /usr/lib/libtcl8.6.so
#7  0x00007ffff7e47363 in Tcl_EvalEx () from /usr/lib/libtcl8.6.so
#8  0x00007ffff7cd7db1 in Tk_BindEvent () from /usr/lib/libtk8.6.so
#9  0x00007ffff7cdca95 in TkBindEventProc () from /usr/lib/libtk8.6.so
#10 0x00007ffff7ce4c35 in Tk_HandleEvent () from /usr/lib/libtk8.6.so
#11 0x00007ffff7ce4e51 in WindowEventProc () from /usr/lib/libtk8.6.so
#12 0x00007ffff7f0efda in Tcl_ServiceEvent () from /usr/lib/libtcl8.6.so
#13 0x00007ffff7f0f257 in Tcl_DoOneEvent () from /usr/lib/libtcl8.6.so
#14 0x00007ffff4d9719d in GUI_init (objc=1, objv=0x55555559d298) at tclxcircuit.c:10050
#15 0x00007ffff4d97706 in xctcl_start (clientData=0x5555555dee20, interp=0x555555598d30, objc=1, objv=0x55555559d298) at tclxcircuit.c:10175
#16 0x00007ffff7e44c62 in TclNRRunCallbacks () from /usr/lib/libtcl8.6.so
#17 0x00007ffff7e46b3a in TclEvalEx () from /usr/lib/libtcl8.6.so
#18 0x00007ffff7f0136a in Tcl_FSEvalFileEx () from /usr/lib/libtcl8.6.so
#19 0x00007ffff7f0150a in Tcl_EvalFile () from /usr/lib/libtcl8.6.so
#20 0x00007ffff7f08ed5 in Tcl_SourceRCFile () from /usr/lib/libtcl8.6.so
#21 0x00007ffff7cf44f6 in Tk_MainEx () from /usr/lib/libtk8.6.so
#22 0x0000555555555263 in main (argc=1, argv=0x7fffffffd848) at xcircexec.c:76
RTimothyEdwards commented 3 years ago

If you can go back to the previous state where it crashed on XQueryPointer(), then instead of doing "bt", run the commands:

    up
    print dpy
    print areawin->area
    print Tk_WindowId(areawin->area)

That would help me debug. I'm not sure what's going on.

syfluqs commented 3 years ago
(gdb) print dpy
$1 = (Display *) 0x0
(gdb) print areawin->area
$2 = (Tk_Window) 0x555555b3fd50
(gdb) print Tk_WindowId(areawin->area)
No symbol "Tk_WindowId" in current context.
(gdb) print areawin->window
$3 = 7599670935249759856
RTimothyEdwards commented 3 years ago

Okay, I'm pretty sure that I understand now what is going on; certain callbacks are being made before the global "dpy" variable is set, and some of those may call routines that depend on "dpy". So I rearranged the code to set "dpy" before allowing the callback functions to run. I think that should fix the problem. Let me know if it doesn't. Again, the fix was pushed to the master branch of the repo on opencircuitdesign.com.

syfluqs commented 3 years ago

It now exits with an X error,

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  3 (X_GetWindowAttributes)
  Resource id in failed request:  0x696c2e70
  Serial number of failed request:  4584
  Current serial number in output stream:  4585

Actually, if I keep the xcircuit window below everything i.e. the window is not in the foreground, I am able to click on the toolbar buttons and the canvas and it works functionally. But as soon as the parent window or any of the child windows are brought to the foreground, it gives me the above X error and exits.

Here is the gdb output if it helps

(gdb) run
Starting program: /usr/lib/xcircuit-3.10/xcircexec 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
XCOps(scale) set to 1
[New Thread 0x7ffff48bb640 (LWP 199628)]
Starting xcircuit under Tcl interpreter

Thread 1 "xcircexec" hit Breakpoint 1, UGetCursor () at functions.c:760
760 {
(gdb) print dpy
$1 = (Display *) 0x5555555f4670
(gdb) print areawin->area
$2 = (Tk_Window) 0x555555b38c80
(gdb) print Tk_WindowId(areawin->area)
No symbol "Tk_WindowId" in current context.
(gdb) break 789
Breakpoint 2 at 0x7ffff4d3585b: file functions.c, line 794.
(gdb) continue
Continuing.

Thread 1 "xcircexec" hit Breakpoint 2, UGetCursor () at functions.c:794
794    newpos.x = xpos;
(gdb) print Tk_WindowId(areawin->area)
No symbol "Tk_WindowId" in current context.
(gdb) print areawin->area
$3 = (Tk_Window) 0x555555b38c80
(gdb) continue
Continuing.
Key 'Button1' is not bound to a macro

Thread 1 "xcircexec" hit Breakpoint 1, UGetCursor () at functions.c:760
760 {
(gdb) print dp
No symbol "dp" in current context.
(gdb) print dpy
$4 = (Display *) 0x5555555f4670
(gdb) continue
Continuing.

Thread 1 "xcircexec" hit Breakpoint 2, UGetCursor () at functions.c:794
794    newpos.x = xpos;
(gdb) continue
Continuing.

Thread 1 "xcircexec" hit Breakpoint 1, UGetCursor () at functions.c:760
760 {
(gdb) continue
Continuing.

Thread 1 "xcircexec" hit Breakpoint 2, UGetCursor () at functions.c:794
794    newpos.x = xpos;
(gdb) continue
Continuing.
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  3 (X_GetWindowAttributes)
  Resource id in failed request:  0x696c2e70
  Serial number of failed request:  3224
  Current serial number in output stream:  3225
[Thread 0x7ffff48bb640 (LWP 199628) exited]
[Inferior 1 (process 199621) exited with code 01]
(gdb) 
RTimothyEdwards commented 3 years ago

Sounds closer to working, anyway. Can you break on "XGetWindowAttributes" and do a backtrace? It's called from some Tk routine, so I don't know where it's called in xcircuit. It may or may not fail the first time it is called, so it may be necessary to keep breaking on it and figure out where it was in xcircuit on the last time it was called before it flagged the invalid Window value.

syfluqs commented 3 years ago

If I repeat continue for about 285-300 times, most of the times, the GUI ran perfectly without any errors.

(gdb) break XGetWindowAttributes
Function "XGetWindowAttributes" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (XGetWindowAttributes) pending.
(gdb) run
Starting program: /usr/lib/xcircuit-3.10/xcircexec 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Breakpoint 1, 0x00007ffff7968a70 in XGetWindowAttributes () from /usr/lib/libX11.so.6
(gdb) continue 300
Will ignore next 299 crossings of breakpoint 1.  Continuing.
XCOps(scale) set to 1
[New Thread 0x7ffff48bb640 (LWP 238912)]
Starting xcircuit under Tcl interpreter
Loaded font file fonts/helvetica.lps
Loaded font file fonts/times_roman.lps
Loaded font file fonts/courier.lps
Loaded font file fonts/symbol.lps
Loaded font file fonts/times_romaniso2.lps
Loaded font file fonts/courieriso2.lps
Loaded font file fonts/helveticaiso2.lps
Loaded font file fonts/times_romaniso5.lps
Created new object Cr::Scedil
Created new object Cr::scedil
Loaded font file fonts/courieriso5.lps
Created new object Hv::scedil
Loaded font file fonts/helveticaiso5.lps
Loaded font file fonts/times_roman.lps
Loaded font file fonts/courier.lps
Loaded font file fonts/helvetica.lps
Loaded library file generic.lps
Loaded library file analog.lps
Loaded library file avlsi.lps
Loaded library file digital.lps
Loaded library file digitaltcl.lps
Loaded library file analoglib3.lps
% 

Sometimes I got the previous X error and other times I got the following error.

(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/lib/xcircuit-3.10/xcircexec 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
XCOps(scale) set to 1

Breakpoint 1, 0x00007ffff7968a70 in XGetWindowAttributes () from /usr/lib/libX11.so.6
(gdb) continue 288
Will ignore next 287 crossings of breakpoint 1.  Continuing.
Starting xcircuit under Tcl interpreter
[New Thread 0x7ffff48bb640 (LWP 239598)]

Thread 1 "xcircexec" received signal SIGSEGV, Segmentation fault.
0x00007ffff78b07f0 in cairo_xlib_surface_set_size () from /usr/lib/libcairo.so.2
(gdb) bt
#0  0x00007ffff78b07f0 in cairo_xlib_surface_set_size () from /usr/lib/libcairo.so.2
#1  0x00007ffff4d14af0 in resizearea (w=0x555555b40ec0, clientdata=0x0, calldata=0x0) at events.c:6435
#2  0x00007ffff4d95aa3 in xctk_resizearea (clientData=0x0, eventPtr=0x7fffffffcb00) at tclxcircuit.c:9557
#3  0x00007ffff7ce4b9f in Tk_HandleEvent () from /usr/lib/libtk8.6.so
#4  0x00007ffff7d02f00 in TkDoConfigureNotify () from /usr/lib/libtk8.6.so
#5  0x00007ffff7cf1e5e in ArrangeGrid () from /usr/lib/libtk8.6.so
#6  0x00007ffff7f31f97 in TclServiceIdle () from /usr/lib/libtcl8.6.so
#7  0x00007ffff7f0f22d in Tcl_DoOneEvent () from /usr/lib/libtcl8.6.so
#8  0x00007ffff4d972b0 in GUI_init (objc=1, objv=0x55555559d298) at tclxcircuit.c:10053
#9  0x00007ffff4d97813 in xctcl_start (clientData=0x5555555dee20, interp=0x555555598d30, objc=1, objv=0x55555559d298) at tclxcircuit.c:10178
#10 0x00007ffff7e44c62 in TclNRRunCallbacks () from /usr/lib/libtcl8.6.so
#11 0x00007ffff7e46b3a in TclEvalEx () from /usr/lib/libtcl8.6.so
#12 0x00007ffff7f0136a in Tcl_FSEvalFileEx () from /usr/lib/libtcl8.6.so
#13 0x00007ffff7f0150a in Tcl_EvalFile () from /usr/lib/libtcl8.6.so
#14 0x00007ffff7f08ed5 in Tcl_SourceRCFile () from /usr/lib/libtcl8.6.so
#15 0x00007ffff7cf44f6 in Tk_MainEx () from /usr/lib/libtk8.6.so
#16 0x0000555555555263 in main (argc=1, argv=0x7fffffffd848) at xcircexec.c:76
(gdb) up
#1  0x00007ffff4d14af0 in resizearea (w=0x555555b40ec0, clientdata=0x0, calldata=0x0) at events.c:6435
6435         cairo_xlib_surface_set_size(areawin->surface, areawin->width,
(gdb) print areawin->surface
$1 = (cairo_surface_t *) 0x286d726f6674616c
(gdb) print areawin->width
$2 = 1159
(gdb) print areawin->height
$3 = 861
(gdb) 

The call to cairo_xlib_surface_set_size is also accessing the earlier surface member from areawin.

I couldn't find a definite place in xcircuit code where the call to XGetWindowAttributes breaks. It certainly appears to be a timing issue/race condition. I suspect everything ran fine most of the time inside the debug environment because of slower execution with a breakpoint on XGetWindowAttributes.

Hope this helps. If there is any other way to investigate further, please let me know.

RTimothyEdwards commented 3 years ago

I'll probably have to get awesomewm and try it myself. This kind of race condition has cropped up before, and is always window manager-dependent. But I have never been able to create a setup that I could duplicate the issue with.

vtamara commented 1 year ago

I have a similar issue trying to compile in OpenBSD/adJ and running with fluxbox as Window Manager.

I compiled the version of the master branch of github that is the same of git://opencircuitdesign.com/xcircuit using Tcl/Tk 8.6.8

After compiling, installing and running it presents the GUI: xcircuit

But pushing any button will produce:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  2 (X_ChangeWindowAttributes)
  Resource id in failed request:  0x0
  Serial number of failed request:  3983
  Current serial number in output stream:  3983

That is very similar to https://github.com/RTimothyEdwards/XCircuit/issues/10#issuecomment-795644565