sillysloft / fluxbox

Fluxbox Window Manager (Mirror)
http://fluxbox.org/news/
Other
0 stars 1 forks source link

Division by zero error #829

Open sillysloft opened 16 years ago

sillysloft commented 16 years ago

Fluxbox v1.0.0

I have a mouse with left/right scroll buttons on the scroll wheel. I have bound these buttons with imwheel ( 1.0.0pre12) to alt+left and alt+right with the following .imwheel options:

"(null)" None, Left, Alt_L|Left None, Right, Alt_L|Right

When in a new workspace with no windows in Fluxbox, if I scroll up or down while also pressing my left or right scroll, Fluxbox freezes and uses inordinate amounts of CPU time. A gdb session revealed the following:

Program received signal SIGFPE, Arithmetic exception. 0x00000000004975a4 in WinClient::applySizeHints (this=0x8b9b90, width=@0x7fff79fa194c, height=@0x7fff79fa1948, display_width=0x0, display_height=0x0, maximizing=false) at WinClient.cc:871 871 static_cast<signed>(width_inc); (gdb) where #0 0x00000000004975a4 in WinClient::applySizeHints (this=0x8b9b90, width=@0x7fff79fa194c, height=@0x7fff79fa1948, display_width=0x0, display_height=0x0, maximizing=false) at WinClient.cc:871 #1 0x000000000048762e in FluxboxWindow::init (this=0x8b9d90) at Window.cc:503 #2 0x0000000000487c9f in FluxboxWindow (this=0x8b9d90, client=@0x8b9b90, tm=@0x80b130, layer=@0x80afb0) at Window.cc:284 #3 0x0000000000444b7b in BScreen::createWindow (this=0x803a30, client=8388609) at Screen.cc:1502 #4 0x0000000000421663 in Fluxbox::handleEvent (this=0x7f8770, e=0x7fff79fa1ce0) at fluxbox.cc:802 #5 0x0000000000421cfb in Fluxbox::eventLoop (this=0x7f8770) at fluxbox.cc:553 #6 0x000000000043d2ed in main (argc=1, argv=0x7fff79fa2328) at main.cc:283

This appears to be a division by zero exception (with width_inc==0 or height_inc==0) as adding the following lines above the problem area resolved the issue:

if (width_inc==0) { width_inc=1; } if (height_inc==0) { height_inc=1; }

Reported by: *anonymous

sillysloft commented 16 years ago

Logged In: YES user_id=1538990 Originator: NO

Why is a window opening? Anyway, thanks for the fix, though I'm moving them to WinClient::updateWMNormalHints(), where they get set (by the application!) in the first place. You should also report this to the application that's setting them. If their intention is to make the window non-resizable, the appropriate way to do that is by setting the minimum size equal to the maximum size. If they want normal treatment, they should just not set the resize increments in the first place, or set them to 1. Our code is taken pretty much directly from the ICCCM, which makes no mention of what to do when the increments are 0.

Original comment by: mark-t

sillysloft commented 16 years ago

Original comment by: mark-t

sillysloft commented 16 years ago

Logged In: YES user_id=1942835 Originator: NO

Thanks! There isn't an application or window open when this behavior was observed. The workspace was blank.

But yes, opening a window prevents the division by zero.

Original comment by: benlevon

sillysloft commented 16 years ago

Original comment by: benlevon

sillysloft commented 16 years ago

Logged In: YES user_id=1538990 Originator: NO

I was referring to your backtrace:

#3 0x0000000000444b7b in BScreen::createWindow (this=0x803a30, client=8388609)

That means that a window is being opened. I'm curious how we got into this code in the first place.

Original comment by: mark-t

sillysloft commented 16 years ago

Original comment by: mark-t