-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Keep reference to callback function on timeout #30877
[Python] Keep reference to callback function on timeout #30877
Conversation
When using a timeout when calling GetConnectedDeviceSync() the callback function DeviceAvailableCallback() gets potentially GC'ed. Make sure we hold a reference to the instance.
PR #30877: Size comparison from 575d600 to 0281a60 Decreases (1 build for efr32)
Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
PR #30877: Size comparison from 575d600 to 1f830aa Increases (1 build for linux)
Decreases (5 builds for cc13x4_26x4, linux, nrfconnect)
Full report (30 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, k32w, linux, mbed, nrfconnect, qpg)
|
PR #30877: Size comparison from 575d600 to a552052 Increases (3 builds for linux)
Decreases (23 builds for cc13x4_26x4, cyw30739, efr32, esp32, linux, nrfconnect, psoc6, telink)
Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also happen to the other callbacks?
I did search through the code to find other implementation, but I did not find another problematic cases. Most of the callbacks are implemented in slightly different ways: E.g. the commission callbacks are part of long-lived object of the type In A quite similar situation I found in |
When using a timeout when calling GetConnectedDeviceSync() the callback function DeviceAvailableCallback() gets potentially GC'ed. Make sure we hold a reference to the instance.
Fixes: #30870