aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoredman007 <edman007@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-11-19 04:32:13 +0000
committeredman007 <edman007@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2009-11-19 04:32:13 +0000
commit82a0af2c3007a9ebcbae4c1af4cc40765b1f5c96 (patch)
tree35761c6b089b8720880def22fc61a53c00ae8a90
parenta8d1a67890585c6593950a94942a119219db82b8 (diff)
downloadlcd4linux-82a0af2c3007a9ebcbae4c1af4cc40765b1f5c96.tar.gz
Make the dbus plugin shutdown without showing dbus leaks when compiled with -DDEBUG
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1066 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_HD44780.c2
-rw-r--r--plugin_dbus.c20
2 files changed, 12 insertions, 10 deletions
diff --git a/drv_HD44780.c b/drv_HD44780.c
index bc3a97e..26f0bc9 100644
--- a/drv_HD44780.c
+++ b/drv_HD44780.c
@@ -1410,7 +1410,7 @@ int drv_HD_init(const char *section, const int quiet)
/* initialize generic GPIO driver */
if ((ret = drv_generic_gpio_init(section, Name)) != 0)
return ret;
-
+
#ifdef WITH_PARPORT
if ((ret = drv_generic_keypad_init(section, Name)) != 0)
return ret;
diff --git a/plugin_dbus.c b/plugin_dbus.c
index a7b623e..da93949 100644
--- a/plugin_dbus.c
+++ b/plugin_dbus.c
@@ -372,6 +372,12 @@ void plugin_exit_dbus(void)
for (i = dbus_results.signals - 1; i >= 0; i--) {
clear_signal_txt(i);
}
+
+#ifdef DEBUG
+ //needs to be called to actually free everything, but might free stuff
+ //mpris_dbus uses and cause a crash on shutdown, enable for leak debugging
+ dbus_shutdown();
+#endif
}
@@ -504,7 +510,6 @@ static int lcd_dbus_init(void)
dbus_error_free(&err);
success &= 1;
} else {
- dbus_connection_ref(sessconn);
setup_dbus_events(sessconn);
}
@@ -513,7 +518,6 @@ static int lcd_dbus_init(void)
info("[DBus] Error connecting to the dbus system bus: %s\n", err.message);
success &= 2;
} else {
- dbus_connection_ref(sysconn);
setup_dbus_events(sysconn);
}
@@ -568,7 +572,6 @@ static void handle_inbound_signal(void *signal, int argc, char **argv)
if (signal_info->event_name != NULL) {
named_event_trigger(signal_info->event_name);
}
- free_args(argc, argv);
}
static lcd_sig_t *lcd_register_signal(const char *sender, const char *path,
@@ -804,7 +807,6 @@ static DBusHandlerResult lcd_sig_received(DBusConnection * connection, DBusMessa
{
(void) connection;
dbus_message_ref(msg);
-
lcd_sig_t *sig = sigv;
//compare the signal to the one we were assigned
if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) {
@@ -817,15 +819,15 @@ static DBusHandlerResult lcd_sig_received(DBusConnection * connection, DBusMessa
dbus_message_unref(msg);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
-
- char **args;
- int argc;
- fill_args(msg, &argc, &args);
-
//call the users function
if (sig->callback != NULL) {
+ char **args;
+ int argc;
+ fill_args(msg, &argc, &args);
sig->callback(sig->user_data, argc, args);
+ free_args(argc, args);
}
+
dbus_message_unref(msg);
return DBUS_HANDLER_RESULT_HANDLED;
}