From 1d11cc324e8ce1741528c61af92ca27e9f4bcfa0 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Thu, 21 Nov 2013 14:46:04 +0100 Subject: [PATCH] device-manager: Don't emit device-removed with a finalized instance https://bugzilla.gnome.org/show_bug.cgi?id=712812 --- clutter/clutter-device-manager.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-device-manager.c b/clutter/clutter-device-manager.c index dbb06a987..32a6e8a4a 100644 --- a/clutter/clutter-device-manager.c +++ b/clutter/clutter-device-manager.c @@ -368,9 +368,14 @@ _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager, manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager); g_assert (manager_class->remove_device != NULL); - manager_class->remove_device (device_manager, device); + /* The subclass remove_device() method will likely unref it but we + have to keep it alive during the signal emission. */ + g_object_ref (device); + manager_class->remove_device (device_manager, device); g_signal_emit (device_manager, manager_signals[DEVICE_REMOVED], 0, device); + + g_object_unref (device); } /*