Fix crashes and memory leaks in the Windows System Volume Plugin
- We were not releasing the system volume callbacks we register when the plugin was destroyed, so the callbacks would access freed memory and crash the app.
- To reproduce the crash: 1. Connect to a phone. 2. Disconnect from the phone. 3. Change the system volume.
- We were not freeing PROPVARIANTs
- We were calling
sendSinkList
for every little event (eg: connecting my headset generated tens of them). We now try to call it less often, only when sinks are added/removed/renamed. - We had redundant checks to not generate events when the change was a noop, but Windows already does this.
- We had code to avoid generating events from our own changes, but actually the Android app needs this to know the changes got applied.
Edited by Albert Vaca Cintora