DisplayColorManagement.dll Parameter error

I’m trying to c++ coding, I have successfully run my program, but I have encountered an exit exception when I close window to exit, I found a loaded error from Windows.Internal.Graphics.Display.DisplayColorManagement.dll, the message displayed means the parameter is wrong.

'Panda.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Internal.Graphics.Display.DisplayColorManagement.dll'. Symbols loaded.
onecoreuap\windows\core\color\moderncolor\winrt\displaycolormanagement\lib\displaycolormanagement.cpp(31)\Windows.Internal.Graphics.Display.DisplayColorManagement.dll!00007FFA8CC63C5D: (caller: 00007FFAA3044F26) ReturnHr(1) tid(bd4) 80070057 参数错误。
Exception thrown at 0x00007FFAA972A839 (KernelBase.dll) in Panda.exe: WinRT originate error - 0x80070057 : '参数错误。'.
Exception thrown at 0x00007FFAA972A839 in Panda.exe: Microsoft C++ exception: winrt::hresult_invalid_argument at memory location 0x0000006F2431E310.
'Panda.exe' (Win32): Unloaded 'C:\Windows\System32\Windows.Internal.Graphics.Display.DisplayColorManagement.dll'

My c++ code and build from Release x64.:

int main(int argc, char *argv[]) {
	PandaFramework framework;
	framework.open_framework(argc, argv);
	framework.set_window_title("Hello World!");

	WindowFramework *window = framework.open_window();

	return (0);

I’m using Chinese language in Windows 10 (1903), Panda3D version is 1.10.3, I think this may be a problem with my system, but I don’t know how to fix it.
I found this problem through Google, but there is not much information.

Today. I trying to python using Visual Studio Code debugger, also encountered exit exception.

from direct.showbase.ShowBase import ShowBase

class Game(ShowBase):
    def __init__(self):
        self.scene = self.loader.loadModel("models/environment")
        self.scene.setScale(0.25, 0.25, 0.25)
        self.scene.setPos(-8, 42, 0)

game = Game()

I think I would check the following settings

  • Make sure that NDEBUG is not part of your preprocessor settings.
  • Are you compiling in Unicode mode? If so, try compiling in non-Unicode mode.

It would also help very much if you could show a stack trace when the crash occurs.

The SystemExit exception is normal and expected. That’s just what Python emits when you call sys.exit(). It seems unrelated to this problem.

Yes, I’m sure not setting NDEBUG and try compiling in non-Unicode mode, it still throw an exit exception.

Follow is call stack:

This is a guess, but I think this is related to the atexit function that Panda registers to restore the gamma table.

I think we can work around by having Panda only register the atexit handler if the gamma is actually changed in the application.

Could you please create a GitHub issue to track this task?

Ok, https://github.com/panda3d/panda3d/issues/685