[gnumeric] About: avoid glib criticals due to unset ->prev in GList.



commit d49eafc97d5361ffc8aac6482d4d1670e27a81f3
Author: Morten Welinder <terra gnome org>
Date:   Wed May 29 23:39:29 2013 -0400

    About: avoid glib criticals due to unset ->prev in GList.

 NEWS                       |    1 +
 src/dialogs/ChangeLog      |    5 +++++
 src/dialogs/dialog-about.c |   32 ++++++++++++++++----------------
 3 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/NEWS b/NEWS
index 7842b81..00363f5 100644
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,7 @@ Morten:
        * Fix missing translation of certain function examples.
        * Add new SNORM.DIST.RANGE function.
        * Fix critical when last row deleted.
+       * Fix criticals in about dialog.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.2
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 5809bed..21b37f4 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-29  Morten Welinder  <mwelinder gmail com>
+
+       * dialog-about.c (create_animation): Avoid creating a GList with
+       bad ->prev pointers.
+
 2013-05-25  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * dialog-cell-format-cond.c (CFormatState): add field
diff --git a/src/dialogs/dialog-about.c b/src/dialogs/dialog-about.c
index 4d6dddc..ba636c0 100644
--- a/src/dialogs/dialog-about.c
+++ b/src/dialogs/dialog-about.c
@@ -440,6 +440,12 @@ about_dialog_anim_draw (G_GNUC_UNUSED GtkWidget *widget,
        return FALSE;
 }
 
+#define APPENDR(r_) do {                       \
+  tail->next = g_list_prepend (NULL, (r_));    \
+  tail->next->prev = tail;                     \
+  tail = tail->next;                           \
+} while (0)
+
 static void
 create_animation (AboutState *state)
 {
@@ -459,15 +465,13 @@ create_animation (AboutState *state)
 
        r = make_text_item (state, _("the efforts of many people."), 3000);
        set_text_motion (r, 0.5, 0.9, 0.5, 0.1);
-       tail->next = g_list_prepend (NULL, r);
-       tail = tail->next;
+       APPENDR (r);
 
        state->now -= 2000;  /* Overlap.  */
 
        r = make_text_item (state, _("Your help is much appreciated!"), 3000);
        set_text_motion (r, 0.5, 0.9, 0.5, 0.1);
-       tail->next = g_list_prepend (NULL, r);
-       tail = tail->next;
+       APPENDR (r);
 
        permutation = g_new (unsigned, N);
        for (ui = 0; ui < N; ui++)
@@ -506,8 +510,7 @@ create_animation (AboutState *state)
 #endif
                }
 
-               tail->next = g_list_prepend (NULL, r);
-               tail = tail->next;
+               APPENDR (r);
        }
 
        g_free (permutation);
@@ -517,40 +520,37 @@ create_animation (AboutState *state)
        r = make_text_item (state, _("We apologize if anyone was left out."),
                            3000);
        set_text_motion (r, 0.5, 0.9, 0.5, 0.1);
-       tail->next = g_list_prepend (NULL, r);
-       tail = tail->next;
+       APPENDR (r);
 
        state->now -= 2000;  /* Overlap.  */
 
        r = make_text_item (state, _("Please contact us to correct mistakes."),
                            3000);
        set_text_motion (r, 0.5, 0.9, 0.5, 0.1);
-       tail->next = g_list_prepend (NULL, r);
-       tail = tail->next;
+       APPENDR (r);
 
        state->now -= 2000;  /* Overlap.  */
 
        r = make_text_item (state, _("Report problems at http://bugzilla.gnome.org";), 3000);
        set_text_motion (r, 0.5, 0.9, 0.5, 0.1);
-       tail->next = g_list_prepend (NULL, r);
-       tail = tail->next;
+       APPENDR (r);
 
        r = make_text_item (state, _("We aim to please!"), 3000);
        r->fade_out = FALSE;
-       tail->next = g_list_prepend (NULL, r);
-       tail = tail->next;
+       APPENDR (r);
 
        state->now -= 100;  /* Overlap.  */
 
        r = make_text_item (state, _("We aim to please!"), 1000);
        r->fade_in = FALSE;
        set_text_expansion (r, 4);
-       tail->next = g_list_prepend (NULL, r);
-       tail = tail->next;
+       APPENDR (r);
 
        state->now = 0;
 }
 
+#undef APPENDR
+
 void
 dialog_about (WBCGtk *wbcg)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]