[glade3/signal-tree-model: 60/358] glade-widget: Fixed memory leak and adjusted const parameters in glade-signal
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3/signal-tree-model: 60/358] glade-widget: Fixed memory leak and adjusted const parameters in glade-signal
- Date: Thu, 6 Jan 2011 13:52:53 +0000 (UTC)
commit bf2fc9120195f144286551996b4c62ddf767e011
Author: Johannes Schmid <jhs gnome org>
Date: Fri Jul 9 22:47:55 2010 +0200
glade-widget: Fixed memory leak and adjusted const parameters in glade-signal
gladeui/glade-signal.c | 2 +-
gladeui/glade-signal.h | 2 +-
gladeui/glade-widget.c | 9 ++++++++-
3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/gladeui/glade-signal.c b/gladeui/glade-signal.c
index d3849f6..9588c12 100644
--- a/gladeui/glade-signal.c
+++ b/gladeui/glade-signal.c
@@ -85,7 +85,7 @@ glade_signal_free (GladeSignal *signal)
* Returns: %TRUE if @sig1 and @sig2 have identical attributes, %FALSE otherwise
*/
gboolean
-glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2)
+glade_signal_equal (const GladeSignal *sig1, const GladeSignal *sig2)
{
gboolean ret = FALSE;
g_return_val_if_fail (GLADE_IS_SIGNAL (sig1), FALSE);
diff --git a/gladeui/glade-signal.h b/gladeui/glade-signal.h
index a60a463..6e650e3 100644
--- a/gladeui/glade-signal.h
+++ b/gladeui/glade-signal.h
@@ -34,7 +34,7 @@ GladeSignal *glade_signal_new (const gchar *name,
GladeSignal *glade_signal_clone (const GladeSignal *signal);
void glade_signal_free (GladeSignal *signal);
-gboolean glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2);
+gboolean glade_signal_equal (const GladeSignal *sig1, const GladeSignal *sig2);
GladeSignal *glade_signal_read (GladeXmlNode *node);
void glade_signal_write (GladeSignal *signal,
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 77cb2f6..7135c90 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -255,7 +255,14 @@ glade_widget_remove_signal_handler(GladeWidget *widget, const GladeSignal *signa
{
g_signal_emit (widget, glade_widget_signals[REMOVE_SIGNAL_HANDLER], 0, tmp_signal_handler);
g_ptr_array_remove_index (signals, i);
- glade_signal_free (tmp_signal_handler);
+ if (signals->len == 0)
+ {
+ g_hash_table_remove (widget->signals, tmp_signal_handler->name);
+ }
+ else
+ {
+ glade_signal_free (tmp_signal_handler);
+ }
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]