Skip to content
Commit 0ba3b653 authored by Thomas Haller's avatar Thomas Haller
Browse files

applet: fix tracking of active access-point

Caught the following valgrind error on
network-manager-applet-1.2.0-0.3.beta1.fc24:

  == Invalid read of size 8
  ==    at 0x822471D: g_type_check_instance (gtype.c:4137)
  ==    by 0x8218B63: g_signal_handlers_disconnect_matched (gsignal.c:2925)
  ==    by 0x129B3D: update_active_ap (applet-device-wifi.c:1195)
  ==    by 0x129C92: wifi_device_state_changed (applet-device-wifi.c:1219)
  ==    by 0x11C96E: foo_device_state_changed_cb (applet.c:2308)
  ==    by 0xF2FCC57: ffi_call_unix64 (in /usr/lib64/libffi.so.6.0.2)
  ==    by 0xF2FC6B9: ffi_call (in /usr/lib64/libffi.so.6.0.2)
  ==    by 0x81FF279: g_cclosure_marshal_generic_va (gclosure.c:1604)
  ==    by 0x81FE7A6: _g_closure_invoke_va (gclosure.c:867)
  ==    by 0x821A1D7: g_signal_emit_valist (gsignal.c:3294)
  ==    by 0x821A82E: g_signal_emit (gsignal.c:3441)
  ==    by 0x7ED59DC: g_simple_async_result_complete (gsimpleasyncresult.c:801)

This happens, because we hookup the access-point at the device, without
taking any strong references or otherwise ensuring proper lifetime
handling.

Fix that, by registering a weak-ref to the access-point, so that we
notice when the access-point gets destroyed. Note that we don't want
to take strong references, because neither device, access-point nor
applet should keep each other alive only because of an active
access-point.

Also, instead of registering the access-point at the device, register
it at the applet. In principle there could be multiple applet instances
and it is wrong that they all try to register the access-point on the
same device.

https://mail.gnome.org/archives/networkmanager-list/2016-March/msg00039.html
parent bbb2932b
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