Commit 40981316 authored by Christian Kellner's avatar Christian Kellner
Browse files

device: hold weak reference to manager

parent a6363637
......@@ -23,6 +23,7 @@
#include "bolt-device.h"
#include "bolt-error.h"
#include "bolt-io.h"
#include "bolt-manager.h"
#include <dirent.h>
#include <libudev.h>
......@@ -31,11 +32,14 @@ struct _BoltDevice
{
BoltDBusDeviceSkeleton object;
char *dbus_path;
/* weak reference */
BoltManager *mgr;
char *uid;
char *name;
char *vendor;
char *dbus_path;
char *uid;
char *name;
char *vendor;
/* when device is attached */
char *syspath;
......@@ -236,6 +240,9 @@ bolt_device_new_for_udev (BoltManager *mgr,
dev->syspath = g_strdup (sysfs);
dev->devdir = g_steal_pointer (&devdir);
g_object_add_weak_pointer (G_OBJECT (mgr),
(gpointer *) &dev->mgr);
return dev;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment