[recipes] edit: Prevent a crash with duplicate recipe IDs



commit fcb0d23e28e58359a508dcd5f64612d941e1eeea
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 19 23:41:33 2017 +0000

    edit: Prevent a crash with duplicate recipe IDs
    
    When we fail to add a recipe to the store, don't set page->recipe,
    since that will lead us down the wrong path (calling update_recipe
    instead of add_recipe) if we try to save it again, causing us to run into an assertion in the recipe store
    code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780276

 src/gr-edit-page.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index f2d2d34..5a36aaf 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -2230,7 +2230,8 @@ gr_edit_page_save (GrEditPage *page)
                                        "images", images,
                                        NULL);
                 ret = gr_recipe_store_add_recipe (store, recipe, &error);
-                g_set_object (&page->recipe, recipe);
+                if (ret)
+                        g_set_object (&page->recipe, recipe);
         }
 
         if (ret) {


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