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 598496 - GtkSpinner gets arithmetic exception if started before visible
GtkSpinner gets arithmetic exception if started before visible
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-10-14 21:59 UTC by Jonny Lamb
Modified: 2009-10-15 00:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix GtkSpinner using style before it's set (4.15 KB, patch)
2009-10-14 22:13 UTC, Bastien Nocera
none Details | Review

Description Jonny Lamb 2009-10-14 21:59:05 UTC
If you create a GtkSpinner, and call gtk_spinner_start on it before showing the widget, you get an arithmetic exception:

22:54 < hadess> yes, because it's not realized, thus doesn't have a GtkStyle yet

For reference:

Program received signal SIGFPE, Arithmetic exception.
0x00007ffff4ac2da4 in IA__gtk_spinner_start (spinner=0x669380) at
gtkspinner.c:537
537      priv->timeout = gdk_threads_add_timeout (priv->cycle_duration /
priv->num_steps, gtk_spinner_timeout, spinner);

both priv->cycle_duration and priv->num_steps are zero.
Comment 1 Bastien Nocera 2009-10-14 22:13:18 UTC
Created attachment 145457 [details] [review]
Fix GtkSpinner using style before it's set

Fix a possible division by zero when the spinner
is started before it's realized (eg. before it has a style
set).
Comment 2 Jonny Lamb 2009-10-14 22:34:44 UTC
This fixes my problem, thanks. I'm no GTK+ reviewer, but the patch looks fine too.
Comment 3 Matthias Clasen 2009-10-14 23:15:54 UTC
Patch looks good. Please commit, Bastien.
Comment 4 Bastien Nocera 2009-10-15 00:44:46 UTC
Attachment 145457 [details] pushed as 7fd79f4 - Fix GtkSpinner using style before it's set

I also moved the notifies slightly earlier so you'd still get
the notification of active even if the widget wasn't realized.