[mutter] native: don't call steal_pointer prematurely
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] native: don't call steal_pointer prematurely
- Date: Wed, 19 Oct 2016 19:23:52 +0000 (UTC)
commit d49106311031cfce2e874125625a5d7c373e807d
Author: Ray Strode <rstrode redhat com>
Date: Wed Oct 19 14:27:24 2016 -0400
native: don't call steal_pointer prematurely
commit e2bfaf07514ed633f8721b5f521577685b6cccc0 does this:
g_hash_table_insert (cards,
g_udev_device_get_name (parent_device),
g_steal_pointer (&parent_device));
The problem is the g_steal_pointer call may happen before the
g_udev_device_get_name call leading to a crash.
This commit does the get_name call on an earlier line
https://bugzilla.gnome.org/show_bug.cgi?id=771442
src/backends/native/meta-launcher.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
index a2885a1..ddb7080 100644
--- a/src/backends/native/meta-launcher.c
+++ b/src/backends/native/meta-launcher.c
@@ -297,6 +297,7 @@ count_devices_with_connectors (const gchar *seat_name,
GUdevDevice *device = tmp->data;
g_autoptr (GUdevDevice) parent_device = NULL;
const gchar *parent_device_type = NULL;
+ const gchar *parent_device_name = NULL;
const gchar *card_seat;
/* filter out the real card devices, we only care about the connectors */
@@ -323,8 +324,9 @@ count_devices_with_connectors (const gchar *seat_name,
if (g_strcmp0 (seat_name, card_seat) != 0)
continue;
+ parent_device_name = g_udev_device_get_name (parent_device);
g_hash_table_insert (cards,
- (gpointer) g_udev_device_get_name (parent_device),
+ (gpointer) parent_device_name ,
g_steal_pointer (&parent_device));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]