[gnumeric] Sheet objects: fix problem with pasting.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Sheet objects: fix problem with pasting.
- Date: Sat, 16 May 2009 15:18:11 -0400 (EDT)
commit fff0842fa2e64a0a2c7c6bc77e7aed7468c828d0
Author: Morten Welinder <terra gnome org>
Date: Sat May 16 15:17:35 2009 -0400
Sheet objects: fix problem with pasting.
---
ChangeLog | 15 +++++++++++++++
NEWS | 1 +
src/clipboard.c | 3 +++
src/graph.c | 1 -
src/gui-clipboard.c | 17 ++++++++++++-----
src/sheet-object.c | 10 +++++++++-
6 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 543e09c..e072774 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-05-16 Morten Welinder <terra gnome org>
+
+ Fix for #490479:
+
+ * src/graph.c (gnm_go_data_preferred_fmt): Don't check dep->sheet.
+
+ * src/sheet-object.c (cb_sheet_object_invalidate_sheet): Clear
+ dep->sheet if necessary.
+
+ * src/gui-clipboard.c (table_cellregion_read): Invalidate the
+ sheets in the temporary workbook.
+
+ * src/clipboard.c (cellregion_invalidate_sheet): Clear
+ ->origin_sheet if that is what we are invalidating.
+
2009-05-16 Andreas J. Guelzow <aguelzow pyrshep ca>
* schemas/gnumeric-dialogs.schemas.in: fix some long descriptions
diff --git a/NEWS b/NEWS
index d256927..259a582 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ Morten:
* Add progress display for OO import.
* Improve ssindex' coverage.
* Make it possible to have horizontal widgets too. [#166487]
+ * Fix sheet-object paste crash. [#490479]
Paul Fitzpatrick:
* Extend ssconvert to also merge multiple sheets. [#581616]
diff --git a/src/clipboard.c b/src/clipboard.c
index 4754644..a47e1b5 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -840,6 +840,9 @@ cellregion_invalidate_sheet (GnmCellRegion *cr,
for (ptr = cr->objects; ptr != NULL ; ptr = ptr->next)
sheet_object_invalidate_sheet (ptr->data, sheet);
+
+ if (cr->origin_sheet == sheet)
+ cr->origin_sheet = NULL;
}
static void
diff --git a/src/graph.c b/src/graph.c
index b1523c7..6922f4e 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -156,7 +156,6 @@ gnm_go_data_preferred_fmt (GOData const *dat)
GnmDependent const *dep = gnm_go_data_get_dep (dat);
g_return_val_if_fail (dep != NULL, NULL);
- g_return_val_if_fail (dep->sheet != NULL, NULL);
eval_pos_init_dep (&ep, dep);
return dep->texpr
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index 7bb2526..56db7fe 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -259,7 +259,7 @@ table_cellregion_read (WorkbookControl *wbc, char const *reader_id,
{
WorkbookView *wb_view = NULL;
Workbook *wb = NULL;
- GSList *l = NULL;
+ GSList *sheets;
GnmCellRegion *ret = NULL;
const GOFileOpener *reader = go_file_opener_for_id (reader_id);
IOContext *ioc;
@@ -279,10 +279,10 @@ table_cellregion_read (WorkbookControl *wbc, char const *reader_id,
}
wb = wb_view_get_workbook (wb_view);
- l = workbook_sheets (wb);
- if (l) {
+ sheets = workbook_sheets (wb);
+ if (sheets) {
GnmRange r;
- Sheet *tmpsheet = (Sheet *) l->data;
+ Sheet *tmpsheet = sheets->data;
r.start.col = 0;
r.start.row = 0;
@@ -290,8 +290,15 @@ table_cellregion_read (WorkbookControl *wbc, char const *reader_id,
r.end.row = tmpsheet->rows.max_used;
ret = clipboard_copy_range (tmpsheet, &r);
}
+ g_slist_free (sheets);
+
+ /* This isn't particularly right, but we are going to delete
+ the workbook shortly. See #490479. */
+ WORKBOOK_FOREACH_SHEET (wb, sheet, {
+ cellregion_invalidate_sheet (ret, sheet);
+ });
+
out:
- g_slist_free (l);
if (wb_view)
g_object_unref (wb_view);
if (wb)
diff --git a/src/sheet-object.c b/src/sheet-object.c
index 9286a93..b56784e 100644
--- a/src/sheet-object.c
+++ b/src/sheet-object.c
@@ -432,6 +432,7 @@ cb_sheet_object_invalidate_sheet (GnmDependent *dep, SheetObject *so, gpointer u
GnmExprRelocateInfo rinfo;
GnmExprTop const *texpr;
gboolean save_invalidated = sheet->being_invalidated;
+ gboolean dep_sheet_invalidated = (dep->sheet == sheet);
if (!dep->texpr)
return;
@@ -439,13 +440,20 @@ cb_sheet_object_invalidate_sheet (GnmDependent *dep, SheetObject *so, gpointer u
sheet->being_invalidated = TRUE;
rinfo.reloc_type = GNM_EXPR_RELOCATE_INVALIDATE_SHEET;
texpr = gnm_expr_top_relocate (dep->texpr, &rinfo, FALSE);
+ if (!texpr && dep_sheet_invalidated) {
+ texpr = dep->texpr;
+ gnm_expr_top_ref (texpr);
+ }
+
sheet->being_invalidated = save_invalidated;
if (texpr) {
gboolean was_linked = dependent_is_linked (dep);
dependent_set_expr (dep, texpr);
gnm_expr_top_unref (texpr);
- if (was_linked)
+ if (dep_sheet_invalidated)
+ dep->sheet = NULL;
+ else if (was_linked)
dependent_link (dep);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]