Skip to content

Commit

Permalink
Clean up appsync list and dbus correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Oct 22, 2013
1 parent 3185279 commit 66d47c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/usb_moded-appsync-dbus.c
Expand Up @@ -274,8 +274,10 @@ gboolean usb_moded_app_sync_init_connection(void)
/* Make sure we do not get forced to exit if dbus session dies or stops */
dbus_connection_set_exit_on_disconnect(dbus_connection_ses, FALSE);

/* Connect D-Bus to the mainloop */
/* Connect D-Bus to the mainloop (Seems it is only needed once and is done at the main
D-Bus init
dbus_connection_setup_with_g_main(dbus_connection_ses, NULL);
*/

/* Request service name */
if( !usb_moded_app_sync_obtain_name() )
Expand Down Expand Up @@ -318,6 +320,7 @@ gboolean usb_moded_app_sync_init(void)
*/
void usb_moded_appsync_cleanup(void)
{
usb_moded_app_sync_cleanup_connection();
// NOP
}

Expand Down
6 changes: 4 additions & 2 deletions src/usb_moded-appsync.c
Expand Up @@ -55,17 +55,19 @@ static void free_elem(gpointer aptr)
struct list_elem *elem = aptr;
free(elem->name);
free(elem->launch);
free(elem->mode);
free(elem);
}

static void free_list(void)
void free_appsync_list(void)
{
if( sync_list != 0 )
{
/*g_list_free_full(sync_list, free_elem); */
g_list_foreach (sync_list, (GFunc) free_elem, NULL);
g_list_free (sync_list);
sync_list = 0;
log_debug("Appsync list freed\n");
}
}

Expand All @@ -76,7 +78,7 @@ void readlist(void)
const gchar *dirname;
struct list_elem *list_item;

free_list();
free_appsync_list();

if( !(confdir = g_dir_open(CONF_DIR_PATH, 0, NULL)) )
goto cleanup;
Expand Down
2 changes: 2 additions & 0 deletions src/usb_moded-appsync.h
Expand Up @@ -47,3 +47,5 @@ void readlist(void);
int activate_sync(const char *mode);
int mark_active(const gchar *name);
int appsync_stop(void);
void free_appsync_list(void);
void usb_moded_appsync_cleanup(void);

0 comments on commit 66d47c2

Please sign in to comment.