2020
2121#include " wx/setup.h"
2222#include " wx/wx.h"
23+ #include < wx/xrc/xmlres.h>
2324
2425// ------------------------------------------------------------------------------------------------
2526// this is AutoCAD's main frame
@@ -53,9 +54,11 @@ bool WxRxApp::OnInit()
5354 return false ;
5455 {
5556 // Hold a ref so wxPython wx.App.Get() returns our app
56- PyAutoLockGIL lock;
57- wxPyConstructObject (wxTheApp, wxT (" wxPyApp" ), true );
57+ PyAutoLockGIL lock;
58+ wxPyConstructObject (wxTheApp, wxT (" wxPyApp" ), true );
5859 }
60+ wxXmlInitResourceModule ();
61+ wxXmlResource::Get ()->InitAllHandlers ();
5962 return true ;
6063}
6164
@@ -68,6 +71,7 @@ int WxRxApp::OnExit()
6871 {
6972 top->DissociateHandle ();
7073 top->SetHWND (0 );
74+ top->Destroy ();
7175 }
7276 wxTopLevelWindows.clear ();
7377 wxPyEndAllowThreads (m_mainTState);
@@ -76,7 +80,7 @@ int WxRxApp::OnExit()
7680
7781void WxRxApp::WakeUpIdle ()
7882{
79- if (auto hwnd = adsw_acadMainWnd (); hwnd != 0 )
83+ if (auto hwnd = adsw_acadMainWnd (); :: IsWindow ( hwnd) )
8084 {
8185 ::PostMessage (hwnd, WM_NULL, 0 , 0 );
8286 }
@@ -171,10 +175,9 @@ static bool initWxApp()
171175
172176static bool uninitWxApp ()
173177{
174- // PyGILState_Ensure ();
175- // Py_FinalizeEx ();
178+ wxXmlResource::Get ()-> ClearHandlers ();
179+ delete wxXmlResource::Get ();
176180 wxEntryCleanup ();
177- PyAutoLockGIL::canLock = false ;
178181 return true ;
179182}
180183
0 commit comments