Init wxRTTI
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@23832 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -42,7 +42,7 @@ public:
|
|||||||
virtual ~MyApp();
|
virtual ~MyApp();
|
||||||
void Init_wxPython();
|
void Init_wxPython();
|
||||||
private:
|
private:
|
||||||
PyThreadState* main_tstate;
|
PyThreadState* m_mainTState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -83,16 +83,22 @@ void MyApp::Init_wxPython()
|
|||||||
// module and sets a pointer to a function table located there.
|
// module and sets a pointer to a function table located there.
|
||||||
wxPyCoreAPI_IMPORT();
|
wxPyCoreAPI_IMPORT();
|
||||||
|
|
||||||
|
// Ensure that the new classes defined in the wxPython wrappers are
|
||||||
|
// recognised by the wx RTTI system. (If you don't use wxWindows in
|
||||||
|
// your C++ app you won't need to do this.)
|
||||||
|
wxClassInfo::CleanUpClasses();
|
||||||
|
wxClassInfo::InitializeClasses();
|
||||||
|
|
||||||
// Save the current Python thread state and release the
|
// Save the current Python thread state and release the
|
||||||
// Global Interpreter Lock.
|
// Global Interpreter Lock.
|
||||||
main_tstate = wxPyBeginAllowThreads();
|
m_mainTState = wxPyBeginAllowThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MyApp::~MyApp()
|
MyApp::~MyApp()
|
||||||
{
|
{
|
||||||
// Restore the thread state and tell Python to cleanup after itself.
|
// Restore the thread state and tell Python to cleanup after itself.
|
||||||
wxPyEndAllowThreads(main_tstate);
|
wxPyEndAllowThreads(m_mainTState);
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user