[gnumeric] GUI: fix problems with in-cell combos.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] GUI: fix problems with in-cell combos.
- Date: Wed, 8 Jul 2009 23:05:33 +0000 (UTC)
commit 5ca148965838c05d71e55a1a20522424efa64584
Author: Morten Welinder <terra gnome org>
Date: Wed Jul 8 19:02:31 2009 -0400
GUI: fix problems with in-cell combos.
ChangeLog | 5 +++++
NEWS | 1 +
src/gnm-cell-combo.c | 41 +++++++++++++++++++++++++++++++++--------
3 files changed, 39 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 79a79ba..e99cf52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-07-08 Morten Welinder <terra gnome org>
+ * src/gnm-cell-combo.c (gnm_cell_combo_set_sv): New function.
+ (gnm_cell_combo_finalize, gnm_cell_combo_set_property): Call
+ gnm_cell_combo_set_sv to release sv weak ref.
+ (gnm_cell_combo_dispose): New function. Fixes #587992.
+
* src/sheet.c (sheet_get_nominal_printarea): Avoid UMR.
2009-07-01 Morten Welinder <terra gnome org>
diff --git a/NEWS b/NEWS
index 710601e..3580a65 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ Morten:
* Simplify Win32 build.
* Convert fn-logical and sample_datasource to new help format.
* Fix problem with print area.
+ * Fix problems with in-sheet combos. [#587992]
--------------------------------------------------------------------------
Gnumeric 1.9.9
diff --git a/src/gnm-cell-combo.c b/src/gnm-cell-combo.c
index 5931886..f0e021c 100644
--- a/src/gnm-cell-combo.c
+++ b/src/gnm-cell-combo.c
@@ -32,29 +32,51 @@ enum {
};
static void
+gnm_cell_combo_set_sv (GnmCellCombo *ccombo, SheetView *sv)
+{
+ if (ccombo->sv == sv)
+ return;
+
+ if (NULL != ccombo->sv)
+ sv_weak_unref (&ccombo->sv);
+
+ ccombo->sv = sv;
+ if (sv)
+ sv_weak_ref (sv, &ccombo->sv);
+}
+
+static void
gnm_cell_combo_finalize (GObject *object)
{
GnmCellCombo *ccombo = GNM_CELL_COMBO (object);
GObjectClass *parent;
- if (NULL != ccombo->sv) {
- sv_weak_unref (&ccombo->sv);
- ccombo->sv = NULL;
- }
+ gnm_cell_combo_set_sv (ccombo, NULL);
parent = g_type_class_peek (SHEET_OBJECT_TYPE);
parent->finalize (object);
}
static void
+gnm_cell_combo_dispose (GObject *object)
+{
+ GnmCellCombo *ccombo = GNM_CELL_COMBO (object);
+ GObjectClass *parent;
+
+ gnm_cell_combo_set_sv (ccombo, NULL);
+ parent = g_type_class_peek (SHEET_OBJECT_TYPE);
+ parent->dispose (object);
+}
+
+static void
gnm_cell_combo_set_property (GObject *obj, guint property_id,
- GValue const *value, GParamSpec *pspec)
+ GValue const *value, GParamSpec *pspec)
{
GnmCellCombo *ccombo = (GnmCellCombo *)obj;
switch (property_id) {
- case PROP_SV : {
+ case PROP_SV: {
SheetView *sv = g_value_get_object (value);
- sv_weak_ref (ccombo->sv = sv, &ccombo->sv);
+ gnm_cell_combo_set_sv (ccombo, sv);
break;
}
@@ -70,7 +92,9 @@ gnm_cell_combo_get_property (GObject *obj, guint property_id,
GnmCellCombo const *ccombo = (GnmCellCombo const *)obj;
switch (property_id) {
- case PROP_SV : g_value_set_object (value, ccombo->sv); break;
+ case PROP_SV:
+ g_value_set_object (value, ccombo->sv);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
}
@@ -87,6 +111,7 @@ static void
gnm_cell_combo_class_init (GObjectClass *gobject_class)
{
SheetObjectClass *so_class = SHEET_OBJECT_CLASS (gobject_class);
+ gobject_class->dispose = gnm_cell_combo_dispose;
gobject_class->finalize = gnm_cell_combo_finalize;
gobject_class->get_property = gnm_cell_combo_get_property;
gobject_class->set_property = gnm_cell_combo_set_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]