Fix crash in DBus plugin

Closes #1438
This commit is contained in:
asarium 2015-08-02 08:06:21 -04:00 committed by TingPing
parent afd2135393
commit 422cce6f70
1 changed files with 3 additions and 1 deletions

View File

@ -366,6 +366,7 @@ remote_object_connect (RemoteObject *obj,
static guint count = 0; static guint count = 0;
char *sender, *path; char *sender, *path;
RemoteObject *remote_object; RemoteObject *remote_object;
gchar count_buffer[15];
sender = dbus_g_method_get_sender (context); sender = dbus_g_method_get_sender (context);
remote_object = g_hash_table_lookup (clients, sender); remote_object = g_hash_table_lookup (clients, sender);
@ -374,7 +375,8 @@ remote_object_connect (RemoteObject *obj,
g_free (sender); g_free (sender);
return TRUE; return TRUE;
} }
path = g_build_filename (DBUS_OBJECT_PATH, count++, NULL); g_snprintf(count_buffer, sizeof(count_buffer), "%u", count++);
path = g_build_filename (DBUS_OBJECT_PATH, count_buffer, NULL);
remote_object = g_object_new (REMOTE_TYPE_OBJECT, NULL); remote_object = g_object_new (REMOTE_TYPE_OBJECT, NULL);
remote_object->dbus_path = path; remote_object->dbus_path = path;
remote_object->filename = g_path_get_basename (filename); remote_object->filename = g_path_get_basename (filename);