diff options
author | Xabier Rodriguez Calvar <xrcalvar@igalia.com> | 2009-10-21 12:40:11 +0200 |
---|---|---|
committer | Xabier Rodriguez Calvar <xrcalvar@igalia.com> | 2009-10-21 12:55:12 +0200 |
commit | 47df9ddbf202cd05c6987abf88f4db0596c5b5cf (patch) | |
tree | a1beccc3e4c1df4696e4924b4cf9c29b0cc487ee | |
parent | f63abecb9b97816e120920d6efef485388f63d2c (diff) |
Unref old selector after sinking new one in the picker button.
We need to do this, otherwise if we set the same selector twice, we
could end up destroying the selector the second time you set it.
Fixes: NB#143759 (Setting the same selector twice to a picker button
ends with the selector destroyed)
-rw-r--r-- | hildon/hildon-picker-button.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hildon/hildon-picker-button.c b/hildon/hildon-picker-button.c index 5264716..b57baf5 100644 --- a/hildon/hildon-picker-button.c +++ b/hildon/hildon-picker-button.c @@ -446,6 +446,7 @@ hildon_picker_button_set_selector (HildonPickerButton * button, { HildonPickerButtonPrivate *priv; gchar *value = NULL; + GtkWidget *old_selector = NULL; g_return_if_fail (HILDON_IS_PICKER_BUTTON (button)); g_return_if_fail (!selector || HILDON_IS_TOUCH_SELECTOR (selector)); @@ -459,7 +460,7 @@ hildon_picker_button_set_selector (HildonPickerButton * button, g_signal_handlers_disconnect_by_func (priv->selector, hildon_picker_button_selector_columns_changed, button); - g_object_unref (priv->selector); + old_selector = priv->selector; } priv->selector = GTK_WIDGET (selector); @@ -484,6 +485,10 @@ hildon_picker_button_set_selector (HildonPickerButton * button, hildon_button_set_value (HILDON_BUTTON (button), value); hildon_picker_button_value_changed (button); + if (old_selector) { + g_object_unref (old_selector); + } + g_free (value); } |