2006-08-31 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ * debian/changelog:
+ * hildon-widgets/hildon-defines.c: Disconnect the signal before
+ attaching a new one -- prevents signals from being emitted two times,
+ fixes a memory leak. Fixes #NB26114.
+
+2006-08-31 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+
* debian/changelog:
* hildon-widgets/hildon-wizard-dialog.c: Changing the orded of the
buttons in the wizard dialog to be: finish, previous, next, cancel.
[Merging 0.13.1 => TRUNK]
* ./: Merging the experimental color selector branch. Fixes: #NB37010,
- #NB38559, #33217, #NB37172.
+ #NB38559, #NB33217, #NB37172.
Maintainer change:
Michael Dominic Kostrzewa
<michael.kostrzewa@nokia.com>
* fixes NB#37172 - Colour selector for background color shows logical string
* fixes NB#37467 - Hildon name password dialog with autocapitalization
* fixes NB#34613 - 'Cancel' and 'Finish' in wrong order in Wizard widget
+ * fixes NB#26114 - hildon_gtk_widget_set_logical_* leak signals
* Merging the new color selector branch (0.13.1) with the main trunk code.
* Maintainer change: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
* Correcting the license headers
* Removing the redundant files
* Allowing menus to be removed from windows by passing NULL to set_menu
- function (documented).
+ function (documented).
* Removing the Johan's new key handling (introduced in 0.13.1.3) for the
- time being. That requires a fix at a different level.
+ time being. That requires a fix at a different level.
* Changing the order of the buttons in the wizard dialog
+ * Disconnect the previous notification signal before connecting the new one
+ (hildon_gtk_widget_set_logical_*)
-- Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com> Wed, 30 Aug 2006 14:30:00 +0300
*
* This function assigns a defined logical font to the @widget and all its child widgets.
* It also connects to the "style_set" signal which will retrieve & assign the new font for the given logical name each time the theme is changed.
- * The returned signal id can be used to disconnect the signal.
+ * The returned signal id can be used to disconnect the signal.
+ * The previous signal (obtained by calling this function) is disconnected automatically and should not be used.
*
* Return value : The signal id that is triggered every time theme is changed. 0 if font set failed.
**/
ld->logicalcolorstring = NULL;
ld->logicalfontstring = g_strdup(logicalfontname);
+ /* Disconnects the previously connected signals. That calls the closure notify
+ * and effectively disposes the allocated data (hildon_logical_data_free) */
+ g_signal_handlers_disconnect_matched (G_OBJECT (widget), G_SIGNAL_MATCH_FUNC,
+ 0, NULL, NULL,
+ G_CALLBACK (hildon_change_style_recursive_from_ld), NULL);
+
/* Change the font now */
hildon_change_style_recursive_from_ld (widget, NULL, ld);
- /* Connect to "style_set" so that the font gets changed whenever theme changes.
-
- FIXME: if this function is called multiple times, the old signal
- handler should be disconnected. However since signal ID is
- returned, this probably can't be done without breaking backwards
- compatibility. */
+ /* Connect to "style_set" so that the font gets changed whenever theme changes. */
signum = g_signal_connect_data (G_OBJECT (widget), "style_set",
G_CALLBACK (hildon_change_style_recursive_from_ld),
ld, (GClosureNotify) hildon_logical_data_free, 0);
* This function assigns a defined logical color to the @widget and all it's child widgets.
* It also connects to the "style_set" signal which will retrieve & assign the new color for the given logical name each time the theme is changed.
* The returned signal id can be used to disconnect the signal.
+ * The previous signal (obtained by calling this function) is disconnected automatically and should not be used.
*
* Example : If the style you want to modify is bg[NORMAL] then set rcflags to GTK_RC_BG and state to GTK_STATE_NORMAL.
*
ld->state = state;
ld->logicalcolorstring = g_strdup(logicalcolorname);
ld->logicalfontstring = NULL;
+
+ /* Disconnects the previously connected signals. That calls the closure notify
+ * and effectively disposes the allocated data (hildon_logical_data_free) */
+ g_signal_handlers_disconnect_matched (G_OBJECT (widget), G_SIGNAL_MATCH_FUNC,
+ 0, NULL, NULL,
+ G_CALLBACK (hildon_change_style_recursive_from_ld), NULL);
/* Change the colors now */
hildon_change_style_recursive_from_ld (widget, NULL, ld);
- /* Connect to "style_set" so that the colors gets changed whenever theme
- changes. FIXME: same as above */
+ /* Connect to "style_set" so that the colors gets changed whenever theme */
signum = g_signal_connect_data (G_OBJECT (widget), "style_set",
G_CALLBACK (hildon_change_style_recursive_from_ld),
ld, (GClosureNotify) hildon_logical_data_free, 0);