From a57179cd0a6814c6e08eef31d671061df1d5af73 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 8 Oct 2005 21:00:50 +0000 Subject: Ensure the images are loaded before starting to spin. Should fix crashes * lib/widgets/ephy-spinner.c: (ephy_spinner_start), (ephy_spinner_dispose), (ephy_spinner_finalize), (ephy_spinner_class_init): Ensure the images are loaded before starting to spin. Should fix crashes on start/new tab. --- ChangeLog | 9 +++++++++ lib/widgets/ephy-spinner.c | 23 ++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index fffc8280f..801dcfa4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ + + + * lib/widgets/ephy-spinner.c: (ephy_spinner_start), + (ephy_spinner_dispose), (ephy_spinner_finalize), + (ephy_spinner_class_init): + + Ensure the images are loaded before starting to spin. + Should fix crashes on start/new tab. + 2005-10-06 Christian Persch * src/ephy-toolbar.c: (ephy_toolbar_update_spinner): diff --git a/lib/widgets/ephy-spinner.c b/lib/widgets/ephy-spinner.c index 2cdc809d1..5ae2876f2 100644 --- a/lib/widgets/ephy-spinner.c +++ b/lib/widgets/ephy-spinner.c @@ -740,17 +740,17 @@ ephy_spinner_start (EphySpinner *spinner) details->spinning = TRUE; if (GTK_WIDGET_MAPPED (GTK_WIDGET (spinner)) && - details->timer_task == 0) + details->timer_task == 0 && + ephy_spinner_load_images (spinner)) + { - - if (spinner->details->images != NULL) + if (details->images != NULL) { /* reset to first frame */ - spinner->details->current_image = - spinner->details->images->images; + details->current_image = details->images->images; } - spinner->details->timer_task = + details->timer_task = g_timeout_add (details->timeout, (GSourceFunc) bump_spinner_frame_cb, spinner); @@ -893,7 +893,7 @@ ephy_spinner_unmap (GtkWidget *widget) } static void -ephy_spinner_finalize (GObject *object) +ephy_spinner_dispose (GObject *object) { EphySpinner *spinner = EPHY_SPINNER (object); @@ -901,6 +901,14 @@ ephy_spinner_finalize (GObject *object) (spinner->details->icon_theme, G_CALLBACK (icon_theme_changed_cb), spinner); + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +ephy_spinner_finalize (GObject *object) +{ + EphySpinner *spinner = EPHY_SPINNER (object); + ephy_spinner_remove_update_callback (spinner); ephy_spinner_unload_images (spinner); @@ -954,6 +962,7 @@ ephy_spinner_class_init (EphySpinnerClass *class) parent_class = g_type_class_peek_parent (class); + object_class->dispose = ephy_spinner_dispose; object_class->finalize = ephy_spinner_finalize; widget_class->expose_event = ephy_spinner_expose; -- cgit v1.2.3