I've stumbled onto a bug in the menu code, but unfortunatley, I don't
have the time to figure out exactly what is happening to offer a
patch[1].  So, here's what I know and how to recreate the bug.  Note,
this is a pretty subtle bug, so bare with my long-winded "analysis."

Summary
-------
The only program I've found that will recreate the bug is DDD[2].  DDD
uses a small helper window to give you easy access to some common
commands.  When you iconify DDD, the helper window goes with it; same
thing happens when you un-iconify DDD.  If you position the Workspaces
menu just right, you can cause BB to lose track of the (un)iconified
windows in the icons menu.  The bug only occurs when two (or more
perhaps) windows are un-iconified by a single mouse-click.  I've only
tested this in blackbox 0.61.1.

Recreation
----------
- Open blackbox...duh
- Make sure you have one program iconified (I have bbkeys).
- Open a program with DDD (make sure the small command window is open;
  it's window title should be "DDD").
- Iconify the main DDD window.  You should now have 3 processes in the
  icon menu: "bbkeys" on top, then "DDD: foo.c", then "DDD".
- Move the Workspaces menu to the bottom of the screen.  Leave about
  the height of one menu item between the bottom of the Workspaces menu
  and the bottom of the screen.  This is important for mouse
  positioning to trigger the bug.
- Click to un-iconify "DDD: foo.c".  Try to get the mouse over where
  the bbkeys item will be once the other two processes are removed from
  the icon menu.
- Move the mouse to create an X mouse event.  You should already be
  over the bbkeys menu item.
- SIGSEGV || try_again()

GDB Output
----------
GNU gdb 5.0
[...]
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) run
Starting program: /archive/incoming/blackbox-0.61.1/src/./blackbox 
BScreen::BScreen: managing screen 0 using visual 0x23, depth 16

Program received signal SIGSEGV, Segmentation fault.
0x804ddbb in Basemenu::motionNotifyEvent (this=0x80826b0, me=0xbfffea7c) at 
Basemenu.hh:183
183       inline Basemenu *submenu(void) { return s; }
(gdb) bt
#0  0x804ddbb in Basemenu::motionNotifyEvent (this=0x80826b0, me=0xbfffea7c) at 
Basemenu.hh:183
#1  0x8068851 in Blackbox::process_event (this=0xbfffeb1c, e=0xbfffea7c) at 
blackbox.cc:524
#2  0x804b876 in BaseDisplay::eventLoop (this=0xbfffeb1c) at BaseDisplay.cc:429
#3  0x806c864 in main (argc=1, argv=0xbffffb8c) at main.cc:255
#4  0x401a7f5c in __libc_start_main () from /lib/libc.so.6

Notes
-----
I put my novice gdb skills to the test and found that the bug is
being triggered by a call to item->submenu() on line 912 of
Basemenu.cc.
--
Cameron


[1] Out of the 172 lines in Basemenu.hh, 1 line is a comment.  Out of
the 1019 lines in Basemenu.cc, 14 lines of it make up a total of 11
comments, 9 of which are for 2 functions.  Applying this ratio to the
rest of the package, there would be about 251 lines of comments in
all of the 18,748 lines of 0.61.1.

[2] DDD, Data Display Debugger, http://www.gnu.org/software/ddd/.

Reply via email to