Crash in PandaFramework::open_window()

Hello,
I’ve just installed Panda and run the examples successfully (I tried just a few).
Now I’m using the first C++ tutorial. It compiles fine, but PandaFramework::open_window() crashes.
Before the crash, I’ve got the following output:

Known pipe types:
wglGraphicsPipe
(all display modules loaded.)

I tried to call get_default_pipe() before calling open_window() and I got a crash too.

I’m using Visual C++ 2005 Express.

Just in case, here is the code from the tutorial:

#include “pandaFramework.h”
#include “pandaSystem.h”

PandaFramework framework;

int _tmain(int argc, _TCHAR* argv[])
{
//open a new window framework
framework.open_framework(argc, argv);
//set the window title to My Panda3D Window
framework.set_window_title(“My Panda3D Window”);
//open the window
WindowFramework *window = framework.open_window();

//here is room for your own code

//do the main loop, equal to run() in python
framework.main_loop();
//close the window framework
framework.close_framework();

return 0;

}

Thank you for your help!

I just realized that the same program works when I compile use release config. If I can find out why it’s crashing only in debug I will post the explanation.
But if somebody knows the answer, please let me know!
:slight_smile:

I’m now running the second example and I’m getting another crash.
NodePath::reparent_to() is raising an exception (it looks like it’s accessing a NULL pointer). The crash is in libpanda.dll and and it happens after having loaded libpandaegg.dll.

Here is the code from the tutorial.

int _tmain(int argc, _TCHAR* argv[])
{
//load the window and stuff
framework.open_framework(argc, argv);
framework.set_window_title(“My Panda3D Window”);
WindowFramework *window = framework.open_window();

//load the environment model
NodePath environ = window->load_model(framework.get_models(),"models/environment");
environ.reparent_to(window->get_render());
environ.set_scale(0.25,0.25,0.25);
environ.set_pos(-8,42,0);

//do the rest
framework.main_loop();
framework.close_framework();

return 0;

}

I was having some linking issues even if I’m linking to all the libs.
I had to add the following code in my project :

MemoryHook * memory_hook = NULL;
TypeHandle TypeHandle::_none;
TypeHandle TypedObject::_type_handle;
TypeHandle ReferenceCount::_type_handle;
Thread * Thread::_main_thread;
TypeHandle TypedWritable::_type_handle;
TypeHandle TypedWritableReferenceCount::_type_handle;
TypeHandle CachedTypedWritableReferenceCount::_type_handle;
TypeHandle CopyOnWriteObject::_type_handle;
TypeHandle PandaNode::CData::_type_handle;
TypeHandle PandaNode::_type_handle;
TypeHandle NodePathComponent::CData::_type_handle;
TypeHandle NodePathComponent::_type_handle;

Thanks in advance for your help!!

Hmm, I think this has to do with missing compiler definitions.
It is discussed which definitions to set here:
discourse.panda3d.org/viewtopic.php?t=2368

Thanks a lot! :smiley:
As explained in the thread I’ve added #define WIN32_VC and that fixed my crash when parenting the model.
I still can’t run the Debug version of the tutorial, I got a crash and the following message HEAP: Invalid allocation size - CCCCCCD0 (exceeded 7ffdefff), even when changing _DEBUG to NDEBUG.
But linking to the non-debug runtime library fixed the crash. I’m guessing that I would need to recompile Panda3D in debug and link with those if I want to be able to use the debug runtime.
Also I can’t access to this page (which according to the thread mention this WIN32_VC) :
panda3d.org/manual/index.php/U … ual_Studio :smiley:

Yeah, both the post and the manual page were horribly outdated. Here’s the old version, in case you’re still interested in seeing it for some reason:
panda3d.org/manual/index.php?title … oldid=4381

It would be useful to have a little something nonetheless :slight_smile:
Can I help with that?