View Single Post
Old 02-08-2020, 03:26 PM   #953
Human being with feelings
Join Date: Jul 2009
Posts: 3,198

I've update the extension to v0.999:
* JS_Window functions: On Linux and macOS, don't crash if handle is invalid.
* JS_Mouse_LoadCursorFromFile: On Windows, accept Unicode paths.
* JS_GDI_ReleaseDC: Can release screen HDCs.

Regarding the JS_Window functions:

Windows' own Win32 functions handle invalid HWNDs gracefully, but WDL/swell crashes (as I dramatically warned in the API documentation). When I first uploaded the extension, WDL/swell did not have a working IsWindow function, and reaper.ValidatePtr(hwnd, "HWND") did not yet exist, so I coded my own IsWindow function. My function work accurately, but was pretty slow, so I didn't want to run it each and every time a window-related function was called. Instead, scripts had to check IsWindow themselves, at strategic times.

REAPER's new ValidatePtr with "HWND" is quite fast -- a fraction of a microsecond -- so I think it is unlikely to affect performance, and I therefore added it to all the window-related functions on macOS and Linux. Hopefully it would prevent a few crashes and make the extension API feel more stable.
juliansader is offline   Reply With Quote