ReaScript: ValidatePtr type "Window*", to prevent crashes [DONE!]
In WDL/swell, IsWindow is not implemented for Linux, and very slow in MacOS. The documentation states that the function is "probably best avoided"...
Since REAPER scripts are usually only interested in REAPER's own windows and child windows, a function that checks whether a pointer is a valid REAPER window would be sufficient -- and probably much faster, if REAPER maintains an updated and easy-to-check list of its own windows.
This can easily be implemented as a new pointer type, "Window*", for ValidatePtr.
EDIT: Changed ValidatePtr2 to ValidatePtr, since windows aren't project-specific.
Last edited by juliansader; 02-03-2021 at 04:08 PM.
|