You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The handlers read the event context with unsafe { *eventcontext } and never check it for null.
This happens in OnDisplayNameChanged, OnIconPathChanged, OnSimpleVolumeChanged, OnChannelVolumeChanged and OnGroupingParamChanged. OnGroupingParamChanged does the same with newgroupingparam.
The SetDisplayName docs say that if the caller passes NULL as the event context, the notification method receives a NULL context pointer.
The volume setters say the same.
Any process that changes the session with a NULL context could then hit a null dereference in our callback.
In practice, Windows 11 delivered a pointer to GUID_NULL, not a NULL pointer, when SetDisplayName was called with a NULL context from the same process.
That doesn't make the docs wrong for every caller or Windows version, though.
Fix: read the pointers with something like unsafe { eventcontext.as_ref() }.copied().unwrap_or_default(), so a null pointer becomes GUID_NULL.
Spurious warning in OnChannelVolumeChanged
When changedchannel is u32::MAX (more than one channel changed), the callback runs for every channel as it should.
The code then falls through to the bounds check on changedchannel and logs "received unsupported changedchannel value".
That branch should return after the loop.
Activity