diff options
author | Dan Gudmundsson <[email protected]> | 2014-03-28 10:16:51 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2014-03-28 10:16:51 +0100 |
commit | 7811310ee2c72173824007d3db73ae2b62a725d9 (patch) | |
tree | 3ed1b81ed09a5230551dbb2aca7135a0942735bf /lib/wx/c_src/wxe_impl.cpp | |
parent | e3f9bf8dbfe4e055753f04125406d29af0ae1050 (diff) | |
parent | c15c7c6b2117320aa5feb2c77781634d055cfcd7 (diff) | |
download | otp-7811310ee2c72173824007d3db73ae2b62a725d9.tar.gz otp-7811310ee2c72173824007d3db73ae2b62a725d9.tar.bz2 otp-7811310ee2c72173824007d3db73ae2b62a725d9.zip |
Merge branch 'dgud/wx/fix-wx3-windows64'
* dgud/wx/fix-wx3-windows64:
wx: Send destroy message direct
wx: Add wxLocale class
wx: Added misc functions
wx: Fix memory garbage collector
wx: Fix possibility to fetch early open msgs on mac
wx: Fix listCtrl sort callback
wx: Fix configure for win64 with wxWidgets-3.0
Diffstat (limited to 'lib/wx/c_src/wxe_impl.cpp')
-rw-r--r-- | lib/wx/c_src/wxe_impl.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp index 5964ccfd00..f617aaf349 100644 --- a/lib/wx/c_src/wxe_impl.cpp +++ b/lib/wx/c_src/wxe_impl.cpp @@ -104,7 +104,7 @@ void meta_command(int what, wxe_data *sd) { } } -void send_msg(const char * type, wxString * msg) { +void send_msg(const char * type, const wxString * msg) { wxeReturn rt = wxeReturn(WXE_DRV_PORT, init_caller); rt.addAtom((char *) "wxe_driver"); rt.addAtom((char *) type); @@ -160,6 +160,13 @@ bool WxeApp::OnInit() return TRUE; } + +#ifdef _MACOSX +void WxeApp::MacOpenFile(const wxString &filename) { + send_msg("open_file", &filename); +} +#endif + void WxeApp::shutdown(wxeMetaCommand& Ecmd) { ExitMainLoop(); } @@ -411,6 +418,13 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) wxWindow *parent = NULL; wxeMemEnv * memenv = refmap[Ecmd.port]; + if(!memenv) { + wxString msg; + msg.Printf(wxT("MemEnv already deleted")); + send_msg("debug", &msg); + return; + } + if(wxe_debug) { wxString msg; msg.Printf(wxT("Destroying all memory ")); @@ -439,7 +453,6 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) } if(recurse_level > 0) { // Delay delete until we are out of dispatch* - delayed_cleanup->Append(Ecmd.Clone()); } else { delete win; } @@ -448,9 +461,10 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) } } - if(recurse_level > 0) + if(recurse_level > 0) { + delayed_cleanup->Append(Ecmd.Clone()); return; - + } // First pass, delete all top parents/windows of all linked objects // fprintf(stderr, "close port %x\r\n", Ecmd.port);fflush(stderr); @@ -486,20 +500,20 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) if(it != ptr2ref.end()) { wxeRefData *refd = it->second; if(refd->alloc_in_erl) { - int type = refd->type; if((refd->type == 1) && ((wxObject *)ptr)->IsKindOf(CLASSINFO(wxBufferedDC))) { ((wxBufferedDC *)ptr)->m_dc = NULL; // Workaround } wxString msg; - if((refd->type == 0)) { // Maybe also class 1 + bool cleanup_ref=true; + if(refd->type == 0) { // Maybe also class 1 wxClassInfo *cinfo = ((wxObject *)ptr)->GetClassInfo(); msg.Printf(wxT("Memory leak: {wx_ref, %d, %s}"), refd->ref, cinfo->GetClassName()); send_msg("error", &msg); } else { - delete_object(ptr, refd); + cleanup_ref = delete_object(ptr, refd); } - if(type == 0 || type > 2) { + if(cleanup_ref) { // Delete refs for leaks and non overridden allocs delete refd; ptr2ref.erase(it); @@ -607,7 +621,7 @@ void WxeApp::clearPtr(void * ptr) { if(((int) refd->pid) != -1) { // Send terminate pid to owner - wxeReturn rt = wxeReturn(WXE_DRV_PORT,refd->memenv->owner, false); + wxeReturn rt = wxeReturn(WXE_DRV_PORT,refd->pid, false); rt.addAtom("_wxe_destroy_"); rt.add(ERL_DRV_PID, refd->pid); rt.addTupleCount(2); |