From c8eba44cfa333b3a231688bc04fe9bbc5c1987f2 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 25 Jan 2013 08:38:24 -0600 Subject: [PATCH] core: fix GObject parent method calling for hw_is_up() Broken by e7caad20c9b30594fc0f700e98a6576e577a764b. Admittedly, GObject is opaque in this area. But here's the equivalent concepts in C++: *_GET_CLASS (object)->function(object): - call youngest implementation of virtual function; checks current object for implementation and calls it, if not overridden by the child, walks up the inheritance chain and calls parent, grandparent, etc. C++ equivalent is calling foo::function(). *_CLASS (object_parent_class)->function(object): - call named parent class implementation, *not* including current object. C++ equivalent is calling ParentClass::function(). Using _GET_CLASS()->function() inside the child implementation of function() recursively calls the child implementation of function() and overflows the call stack. --- src/nm-device-vlan.c | 2 +- src/nm-device-wifi.c | 2 +- src/nm-device-wired.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nm-device-vlan.c b/src/nm-device-vlan.c index 8bbc0f0eea..bd6ae3b8e4 100644 --- a/src/nm-device-vlan.c +++ b/src/nm-device-vlan.c @@ -136,7 +136,7 @@ hw_bring_up (NMDevice *dev, gboolean *no_firmware) guint i = 20; while (i-- > 0 && !success) { - success = NM_DEVICE_GET_CLASS (dev)->hw_bring_up (dev, no_firmware); + success = NM_DEVICE_CLASS (nm_device_vlan_parent_class)->hw_bring_up (dev, no_firmware); g_usleep (50); } diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c index e7d5b8c5e4..36721b8811 100644 --- a/src/nm-device-wifi.c +++ b/src/nm-device-wifi.c @@ -811,7 +811,7 @@ hw_bring_up (NMDevice *device, gboolean *no_firmware) if (!NM_DEVICE_WIFI_GET_PRIVATE (device)->enabled) return FALSE; - return NM_DEVICE_GET_CLASS (device)->hw_bring_up (device, no_firmware); + return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->hw_bring_up (device, no_firmware); } static gboolean diff --git a/src/nm-device-wired.c b/src/nm-device-wired.c index a5d690b7a5..34150f4e1a 100644 --- a/src/nm-device-wired.c +++ b/src/nm-device-wired.c @@ -343,7 +343,7 @@ hw_bring_up (NMDevice *dev, gboolean *no_firmware) gboolean result, carrier; guint32 caps; - result = NM_DEVICE_GET_CLASS(dev)->hw_bring_up (dev, no_firmware); + result = NM_DEVICE_CLASS(nm_device_wired_parent_class)->hw_bring_up (dev, no_firmware); if (result) { caps = nm_device_get_capabilities (dev); if (caps & NM_DEVICE_CAP_CARRIER_DETECT) {