[gnumeric] Sheet: plug more leaks.



commit 9ec1369a10d674ba3d895780cd589d09febdf759
Author: Morten Welinder <terra gnome org>
Date:   Sat Dec 6 11:14:46 2014 -0500

    Sheet: plug more leaks.

 ChangeLog   |    3 ++-
 src/sheet.c |   42 ++++++++++++++++++++++--------------------
 2 files changed, 24 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6999b63..7cf0c97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2014-12-06  Morten Welinder  <terra gnome org>
 
-       * src/sheet.c (sheet_insert_rows, sheet_insert_cols): Plug leak.
+       * src/sheet.c (sheet_insert_rows, sheet_insert_cols)
+       (sheet_delete_cols, sheet_delete_rows): Plug leaks.
 
        * src/command-context.c (gnm_cmd_context_error_splits_array): Plug
        leak.
diff --git a/src/sheet.c b/src/sheet.c
index 49781de..aa53a87 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -5108,7 +5108,6 @@ sheet_insert_cols (Sheet *sheet, int col, int count,
        g_return_val_if_fail (count > 0, TRUE);
 
        if (pundo) *pundo = NULL;
-       schedule_reapply_filters (sheet, pundo);
 
        /* 0. Check displaced/deleted region and ensure arrays aren't divided. */
        /* We need to check at "col" and at "first".  If they coincide, just
@@ -5121,6 +5120,8 @@ sheet_insert_cols (Sheet *sheet, int col, int count,
                                      cc, _("Insert Columns")))
                return TRUE;
 
+       schedule_reapply_filters (sheet, pundo);
+
        /* 1. Delete all columns (and their cells) that will fall off the end */
        if (pundo) {
                int last = first + (count - 1);
@@ -5193,15 +5194,6 @@ sheet_delete_cols (Sheet *sheet, int col, int count,
        }
 
        if (pundo) *pundo = NULL;
-       schedule_reapply_filters (sheet, pundo);
-
-       if (pundo) {
-               int last = col + (count - 1);
-               GnmRange r;
-               range_init_cols (&r, sheet, col, last);
-               combine_undo (pundo, clipboard_copy_range_undo (sheet, &r));
-               states = colrow_get_states (sheet, TRUE, col, last);
-       }
 
        reloc_info.reloc_type = GNM_EXPR_RELOCATE_COLS;
        reloc_info.sticky_end = !beyond_end;
@@ -5219,7 +5211,16 @@ sheet_delete_cols (Sheet *sheet, int col, int count,
                                      cc, _("Delete Columns")))
                return TRUE;
 
+       schedule_reapply_filters (sheet, pundo);
+
        /* 1. Delete the columns (and their cells) */
+       if (pundo) {
+               int last = col + (count - 1);
+               GnmRange r;
+               range_init_cols (&r, sheet, col, last);
+               combine_undo (pundo, clipboard_copy_range_undo (sheet, &r));
+               states = colrow_get_states (sheet, TRUE, col, last);
+       }
        for (i = col + count ; --i >= col; )
                sheet_col_destroy (sheet, i, TRUE);
 
@@ -5279,7 +5280,6 @@ sheet_insert_rows (Sheet *sheet, int row, int count,
        g_return_val_if_fail (count > 0, TRUE);
 
        if (pundo) *pundo = NULL;
-       schedule_reapply_filters (sheet, pundo);
 
        /* 0. Check displaced/deleted region and ensure arrays aren't divided. */
        /* We need to check at "row" and at "first".  If they coincide, just
@@ -5292,6 +5292,8 @@ sheet_insert_rows (Sheet *sheet, int row, int count,
                                      cc, _("Insert Rows")))
                return TRUE;
 
+       schedule_reapply_filters (sheet, pundo);
+
        /* 1. Delete all rows (and their cells) that will fall off the end */
        if (pundo) {
                int last = first + (count - 1);
@@ -5364,15 +5366,6 @@ sheet_delete_rows (Sheet *sheet, int row, int count,
        }
 
        if (pundo) *pundo = NULL;
-       schedule_reapply_filters (sheet, pundo);
-
-       if (pundo) {
-               int last = row + (count - 1);
-               GnmRange r;
-               range_init_rows (&r, sheet, row, last);
-               combine_undo (pundo, clipboard_copy_range_undo (sheet, &r));
-               states = colrow_get_states (sheet, FALSE, row, last);
-       }
 
        reloc_info.reloc_type = GNM_EXPR_RELOCATE_ROWS;
        reloc_info.sticky_end = !beyond_end;
@@ -5390,7 +5383,16 @@ sheet_delete_rows (Sheet *sheet, int row, int count,
                                      cc, _("Delete Rows")))
                return TRUE;
 
+       schedule_reapply_filters (sheet, pundo);
+
        /* 1. Delete the rows (and their content) */
+       if (pundo) {
+               int last = row + (count - 1);
+               GnmRange r;
+               range_init_rows (&r, sheet, row, last);
+               combine_undo (pundo, clipboard_copy_range_undo (sheet, &r));
+               states = colrow_get_states (sheet, FALSE, row, last);
+       }
        for (i = row + count ; --i >= row; )
                sheet_row_destroy (sheet, i, TRUE);
 


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