mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 15:14:38 +01:00
The current code has the profile ref the device, but the device has no back-ref to the profile. The following code will free the profile from underneath the client, despite the caller still having a valid ref: p = ratbag_device_get_profile_by_index(device, 0); ratbag_profile_ref(p); ratbag_device_unref(device); Fix this by not using refs internally. After probe, the device is static anyway, so the various refs internally aren't needed. Instead, we also ref/unref the parent struct whenever we ref/unref a struct. Thus, whenevever the device refcount reaches zero, we know the caller has no ref active. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>