Skip to content

Commit be01939

Browse files
committed
Adding a call to g_threads_init() appears to resolve the random crashes.
1 parent 191218a commit be01939

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CFLAGS ?= -g
22
CFLAGS += -Wall
33

44
PKG_CONFIG ?= pkg-config
5-
PKGS = glib-2.0 dbus-1 dbus-glib-1
5+
PKGS = glib-2.0 gthread-2.0 dbus-1 dbus-glib-1
66

77
CFLAGS += `$(PKG_CONFIG) --cflags $(PKGS)`
88
LDLIBS += `$(PKG_CONFIG) --libs $(PKGS)`

echo_calling_service_threaded.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ int init_glib_dbus(char *namespace, char *path,
142142
guint32 err, ret;
143143
GObject *handle;
144144

145-
dbus_threads_init_default();
146145
g_type_init();
147-
146+
g_thread_init(NULL);
147+
dbus_g_thread_init();
148+
//dbus_threads_init_default(); still needed? */
148149
handle = g_object_new(G_TYPE_OBJECT, NULL);
149150
if (handle == NULL) {
150151
log(LOG_ERR, "Can't create handle\n");

0 commit comments

Comments
 (0)