core: fix GObject parent method calling for hw_is_up()

Broken by e7caad20c9.

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.
This commit is contained in:
Dan Williams 2013-01-25 08:38:24 -06:00
parent dfa799cb40
commit c8eba44cfa
3 changed files with 3 additions and 3 deletions

View file

@ -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);
}

View file

@ -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

View file

@ -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) {