prevent crash at exit

This commit is contained in:
David Rose 2009-10-07 00:30:24 +00:00
parent 6b0f19f13e
commit 843bc110c4

View File

@ -14,6 +14,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "PPPandaObject.h" #include "PPPandaObject.h"
#include "load_plugin.h"
PPandaObject::PPandaObject( PPInterface* interfac, P3D_object* p3dObject ) : PPandaObject::PPandaObject( PPInterface* interfac, P3D_object* p3dObject ) :
m_interface( interfac ), m_p3dObject( p3dObject ), m_refs( 0 ), m_ptinfo( NULL ) m_interface( interfac ), m_p3dObject( p3dObject ), m_refs( 0 ), m_ptinfo( NULL )
@ -31,7 +32,10 @@ PPandaObject::~PPandaObject()
{ {
m_ptinfo->Release(); m_ptinfo->Release();
} }
if ( m_p3dObject )
// Clean up the p3d_object, but only if we haven't already
// unloaded the plugin.
if ( m_p3dObject && is_plugin_loaded() )
{ {
P3D_OBJECT_DECREF( m_p3dObject ); P3D_OBJECT_DECREF( m_p3dObject );
} }