Open ennis opened 5 years ago
Thanks very much for catching these, @ennis. Feel free to submit a PR if you can. If you can't (e.g., because of CLA issues), let us know. Thanks again!
Filed as internal issue #USD-5385
This is my attempt on fixing the issue: #1102
Description of Issue
A simple application using GarchGLDebugWindow crashes on windows with error
Steps to Reproduce
System Information (OS, Hardware)
OS: Windows x64
Package Versions
USD v19.05
Build Flags
Built USD with --debug
Additional Information
There seems to be several issues with the code in glPlatformDebugWindowWindows.cpp:
When calling CreateWindowEx, the message handler
&Garch_GLPlatformDebugWindow::_MsgProc
is called but the window has not been registered yet in_GetWindowsMap
. In this case, the message handler returns 0 instead of forwarding to DefWindowProc. https://github.com/PixarAnimationStudios/USD/blob/32ca7df94c83ae19e6fd38f7928d07f0e4cf5040/pxr/imaging/lib/garch/glPlatformDebugWindowWindows.cpp#L168-L170There is a typo (
_hInstnace
) inGarch_GLPlatformDebugWindow::Init
. The rest of the code uses the uninitialized value of the member variable_hInstance
. https://github.com/PixarAnimationStudios/USD/blob/32ca7df94c83ae19e6fd38f7928d07f0e4cf5040/pxr/imaging/lib/garch/glPlatformDebugWindowWindows.cpp#L67The constructor of
Garch_GLPlatformDebugWindow
does not set_callback
, causing the program to crash when it is invoked here: https://github.com/PixarAnimationStudios/USD/blob/32ca7df94c83ae19e6fd38f7928d07f0e4cf5040/pxr/imaging/lib/garch/glPlatformDebugWindowWindows.cpp#L130After fixing all of these, the window initializes seemingly without error.