Actually the problem was that I created p_framework as nullptr in Window.h, and in Window.cpp / void initialization() I initialized PandaFramework and set p_framework as link to new initialized PandaFramework. The solution was to initialize PandaFramework in Window.h, and in Window.cpp using this->p_framework just open the framework (.open_framework).
is a cardinal sin in C++: you’re creating a PandaFramework that has a local scope in the function, and then storing a reference to that local framework that exceeds the lifetime of that function.
But that PandaFramework will destroy when the initialize() function finishes! So that reference you stored is now pointing to some random place in the stack that probably contains some completely other object by that point, and you’re getting extremely undefined behaviour.
You need to allocate the PandaFramework on the heap (using new) or give it some other lifetime outside the function such as by declaring it in main() or putting it in global scope.