GNOME Bugzilla – Bug 598496
GtkSpinner gets arithmetic exception if started before visible
Last modified: 2009-10-15 00:44:49 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.
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).
This fixes my problem, thanks. I'm no GTK+ reviewer, but the patch looks fine too.
Patch looks good. Please commit, Bastien.
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.