After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 672763 - Floating point exception in Gtk.Grid() if grid emptied
Floating point exception in Gtk.Grid() if grid emptied
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-03-24 18:53 UTC by narnie
Modified: 2012-03-24 21:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testgrid: add a testcase (1.43 KB, patch)
2012-03-24 21:19 UTC, Matthias Clasen
committed Details | Review
grid: avoid a floating point exception (905 bytes, patch)
2012-03-24 21:19 UTC, Matthias Clasen
committed Details | Review

Description narnie 2012-03-24 18:53:27 UTC
I have a GTK3 python program I am developing. I need to change the look of the window based on the type of activity the user is doing. I'm using a Gtk.Grid() object that I was planning on just calling widget.hide() on the things I need to appear and widget2.show() on the ones I need to show for the change. I need to remove everything from a Gtk.Grid() and repopulate the grid with new widgets so at one point, the grid would be emptied.

An example of the GUI interface is this

______________________
| Label1   |  Button |
| Label2   |         |
| Label3   |         |
______________________

When I click on button, calls an iterable object I have created that calls Label1.hide(), etc. The interface is an horizontal Gtk.Box() with a grid for the labels on the left and then the button object on the right.

When I get to the last Label3 and then Click the "Button" button, the program unexpectedly exits with this as output:

"
Floating point exception
"

I did a gdb on it and received this info:

"
Program received signal SIGFPE, Arithmetic exception.
0x00007ffff33a6b86 in gtk_grid_request_allocate (request=0x7fffffffc0c0, orientation=<optimized out>, total_size=0)
    at /tmp/buildd/gtk+3.0-3.2.3/./gtk/gtkgrid.c:992
992	/tmp/buildd/gtk+3.0-3.2.3/./gtk/gtkgrid.c: No such file or directory.
"

This seems to be a bug. Is it in fact? What else can I do to help (I'm not a C programmer so I can't help in that vain)?
Comment 1 Matthias Clasen 2012-03-24 21:02:39 UTC
Could you get a complete stacktrace with debug information ?
Comment 2 narnie 2012-03-24 21:11:44 UTC
Sure, can you walk me through how to do that?

To get the above error, I ran:

$ gdb python

Then from gdb did

(gdb) run

then from python, imported my program and ran it to get the above error.

My version of gdb wasn't compiled with --with-python, so I can't run the python program via #! /usr/bin/gdb -P. Also, python-gdb is not in my package repo. I am using Debian testing.

My apologies for being very much a noob at debugging like this.
Comment 3 Matthias Clasen 2012-03-24 21:19:20 UTC
The following fixes have been pushed:
32c7cdd testgrid: add a testcase
ed17c74 grid: avoid a floating point exception
Comment 4 Matthias Clasen 2012-03-24 21:19:22 UTC
Created attachment 210532 [details] [review]
testgrid: add a testcase

Add a testcase for an empty, homogeneous grid.
Comment 5 Matthias Clasen 2012-03-24 21:19:25 UTC
Created attachment 210533 [details] [review]
grid: avoid a floating point exception

When a homogeneous grid has no visible children, we were
accidentally doing a division by zero. Instead, just bail
out early in this case, there is nothing to allocate anyway.
Comment 6 narnie 2012-03-24 21:24:59 UTC
(In reply to comment #3)
> The following fixes have been pushed:
> 32c7cdd testgrid: add a testcase
> ed17c74 grid: avoid a floating point exception

Rats! I did a search for this error, too.

Glad it is fixed. I'll do a work-around for now, but will be glad for the libgtk upgrade when me distro pushes it.