[gnumeric] Deps: fix crash related to dynamic deps.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Deps: fix crash related to dynamic deps.
- Date: Mon, 21 Mar 2011 15:38:57 +0000 (UTC)
commit 0643e252fa4f9a0bf99aa55d9cd67d7d02d582f0
Author: Morten Welinder <terra gnome org>
Date: Mon Mar 21 11:37:13 2011 -0400
Deps: fix crash related to dynamic deps.
I'm certain that the patch avoid the problem, but I am not certain
that the situation in which the crash occurred should be allowed to
happen: an unlinked dep with dynamic dependencies.
ChangeLog | 7 +++++++
NEWS | 1 +
src/dependent.c | 16 +++++++++++++++-
src/dependent.h | 1 +
src/wbc-gtk.c | 4 +---
5 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 786fa6e..67818fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-21 Morten Welinder <terra gnome org>
+
+ * src/dependent.c (dependent_set_expr): Make sure we clear dynamic
+ deps, even if not linked. Fixes #645209.
+ (dependents_dump): New function extracted from...
+ * src/wbc-gtk.c (cb_workbook_debug_info): ...here.
+
2011-03-18 Morten Welinder <terra gnome org>
* src/parser.y: Apply ugly patch for xlsx global names. See bug
diff --git a/NEWS b/NEWS
index 0f1d6e9..8aef202 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,7 @@ Morten:
* Hopefully make print preview work on win32. [#533795]
* Improve quit dialog's non-ascii handling. [#644982]
* Make print-preview work on win32 by avoiding gtk+. [#533795]
+ * Fix crash related to dynamic deps. [#645209]
Stanley Pinchak:
* Improve "dif" output.
diff --git a/src/dependent.c b/src/dependent.c
index 814fb0e..8e38c92 100644
--- a/src/dependent.c
+++ b/src/dependent.c
@@ -41,6 +41,7 @@
#include <string.h>
static void dependent_changed (GnmDependent *dep);
+static void dependent_clear_dynamic_deps (GnmDependent *dep);
/* ------------------------------------------------------------------------- */
@@ -365,6 +366,8 @@ dependent_set_expr (GnmDependent *dep, GnmExprTop const *new_texpr)
if (dependent_is_linked (dep))
dependent_unlink (dep);
+ if (dep->flags & DEPENDENT_HAS_DYNAMIC_DEPS)
+ dependent_clear_dynamic_deps (dep);
if (t == DEPENDENT_CELL) {
/*
@@ -1330,7 +1333,7 @@ dependent_add_dynamic_dep (GnmDependent *dep, GnmRangeRef const *rr)
workbook_link_3d_dep (dep);
}
-static inline void
+static void
dependent_clear_dynamic_deps (GnmDependent *dep)
{
g_hash_table_remove (dep->sheet->deps->dynamic_deps, dep);
@@ -2972,6 +2975,17 @@ gnm_dep_container_dump (GnmDepContainer const *deps,
}
void
+dependents_dump (Workbook *wb)
+{
+ WORKBOOK_FOREACH_SHEET
+ (wb, sheet,
+ {
+ g_printerr ("Dependencies for %s:\n", sheet->name_unquoted);
+ gnm_dep_container_dump (sheet->deps, sheet);
+ });
+}
+
+void
gnm_dep_container_sanity_check (GnmDepContainer const *deps)
{
GnmDependent const *dep;
diff --git a/src/dependent.h b/src/dependent.h
index ced8307..78da677 100644
--- a/src/dependent.h
+++ b/src/dependent.h
@@ -110,6 +110,7 @@ void workbook_queue_all_recalc (Workbook *wb);
GnmDepContainer *gnm_dep_container_new (Sheet *sheet);
void gnm_dep_container_dump (GnmDepContainer const *deps,
Sheet *sheet);
+void dependents_dump (Workbook *wb);
void gnm_dep_container_sanity_check (GnmDepContainer const *deps);
void gnm_dep_container_resize (GnmDepContainer *deps, int rows);
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index f66aa56..575e181 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -2206,9 +2206,7 @@ cb_workbook_debug_info (WBCGtk *wbcg)
Workbook *wb = wb_control_get_workbook (WORKBOOK_CONTROL (wbcg));
if (gnm_debug_flag ("deps")) {
- WORKBOOK_FOREACH_SHEET (wb, sheet,
- g_printerr ("Dependencies for %s:\n", sheet->name_unquoted);
- gnm_dep_container_dump (sheet->deps, sheet););
+ dependents_dump (wb);
}
if (gnm_debug_flag ("expr-sharer")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]