[gnumeric] Paste: fix potential problem with object pasting.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Paste: fix potential problem with object pasting.
- Date: Thu, 3 May 2018 17:39:19 +0000 (UTC)
commit ff8484847f03e27c85b1f09c125ca91f50af2365
Author: Morten Welinder <terra gnome org>
Date: Thu May 3 13:38:51 2018 -0400
Paste: fix potential problem with object pasting.
ChangeLog | 9 ++++++++-
NEWS | 3 +++
src/commands.c | 18 +++++++++++++-----
3 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 60c9482..9eeca48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
+2018-05-03 Morten Welinder <terra gnome org>
+
+ * src/commands.c (get_new_objects): Change from transfer-container
+ to transfer-full. Otherwise a deleted object can shadow a new
+ one. (Never observed.)
+
2018-04-30 Morten Welinder <terra gnome org>
- * src/wbc-gtk.c (wbc_gtk_reload_recent_file_menu): Make full history item
+ * src/wbc-gtk.c (wbc_gtk_reload_recent_file_menu): Make full
+ history item insensitive if we have to history.
2018-04-29 Morten Welinder <terra gnome org>
diff --git a/NEWS b/NEWS
index 60f7937..df72203 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
Gnumeric 1.12.41
+Morten:
+ * Fix problem with object pasting.
+
--------------------------------------------------------------------------
Gnumeric 1.12.40
diff --git a/src/commands.c b/src/commands.c
index 6671a6c..aceebbd 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -2936,11 +2936,20 @@ by_addr (gconstpointer a, gconstpointer b)
return 0;
}
+/**
+ * get_new_objects:
+ * @sheet: #Sheet to query
+ * @old: (element-type SheetObject): list of objects to disregard
+ *
+ * Returns: (transfer full) (element-type SheetObject): A list of new objects
+ * in sheet since @old was collected.
+ */
static GSList *
get_new_objects (Sheet *sheet, GSList *old)
{
- GSList *objs = g_slist_sort (g_slist_copy (sheet->sheet_objects),
- by_addr);
+ GSList *objs =
+ g_slist_sort (go_slist_map (sheet->sheet_objects, g_object_ref),
+ by_addr);
GSList *p = objs, *last = NULL;
while (old) {
@@ -2999,13 +3008,12 @@ cmd_paste_copy_impl (GnmCommand *cmd, WorkbookControl *wbc,
GO_CMD_CONTEXT (wbc))) {
/* There was a problem, avoid leaking */
cellregion_unref (contents);
- g_slist_free (old_objects);
+ g_slist_free_full (old_objects, g_object_unref);
return TRUE;
}
me->pasted_objects = get_new_objects (me->dst.sheet, old_objects);
- g_slist_foreach (me->pasted_objects, (GFunc)g_object_ref, NULL);
- g_slist_free (old_objects);
+ g_slist_free_full (old_objects, g_object_unref);
if (!is_undo && !me->has_been_through_cycle) {
colrow_autofit (me->dst.sheet, &me->dst.range, FALSE, FALSE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]