HDR-Development / HewDraw-Remix

GNU Affero General Public License v3.0
91 stars 86 forks source link

Check for hid:hdr service deadlocks when service is not present #2038

Open liamwhite opened 10 months ago

liamwhite commented 10 months ago

This code: https://github.com/HDR-Development/HewDraw-Remix/blob/7f5de9a768fefe4a885433599ef6f65dd36f629e/plugin/src/lib.rs#L442-L447

Will call connect_to_hid_hdr here, which does this:

    let mut handle = 0u32;
    let result = unsafe { get_service_handle(&mut handle, b"hid:hdr\0".as_ptr(), 7) };

get_service_handle calls the GetServiceHandle interface method on sm:, which blocks until the service is available. This seems to not be intended, because the hid-hdr module exports a function named does_hid_hdr_exist that correctly checks if the service is available.

I'm not sure if the ideal refactoring here is to check for service availability in setup_hid_hdr in this repository, or get_hid_hdr_status in the hid-hdr repository.

blu-dev commented 10 months ago

Thank you for the detailed explanation, I've run into this before but thought that I resolved it. I will look into it!