aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src/wxe_impl.cpp
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2016-05-27 11:53:13 +0200
committerDan Gudmundsson <[email protected]>2016-05-30 13:17:40 +0200
commitb304be8094f283001d6dfbafab31ead37c585869 (patch)
tree355c614d17c6974cec335b9e76728574449ae0bb /lib/wx/c_src/wxe_impl.cpp
parentd5bacdbe0ff1a4327e5e502a0b8cfdddf76e5d86 (diff)
downloadotp-b304be8094f283001d6dfbafab31ead37c585869.tar.gz
otp-b304be8094f283001d6dfbafab31ead37c585869.tar.bz2
otp-b304be8094f283001d6dfbafab31ead37c585869.zip
wx: Fix occasional seq fault after appliction stops
There seems to be a timeing dependent double delete when doing reference cleanup after wx:destroy(). wxGraphicsObjects can thus not be free'ed by wx in the cleanup phase. A guess is that the underlying rendering context deletes all graphics objects without careeing about wxWidgets reference counting.
Diffstat (limited to 'lib/wx/c_src/wxe_impl.cpp')
-rw-r--r--lib/wx/c_src/wxe_impl.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index 175bcfce54..0d2da5d4a7 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -490,7 +490,7 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd)
if(it != ptr2ref.end()) {
wxeRefData *refd = it->second;
if(refd->alloc_in_erl) {
- if((refd->type == 4) && ((wxObject *)ptr)->IsKindOf(CLASSINFO(wxBufferedDC))) {
+ if((refd->type == 8) && ((wxObject *)ptr)->IsKindOf(CLASSINFO(wxBufferedDC))) {
((wxBufferedDC *)ptr)->m_dc = NULL; // Workaround
}
wxString msg;
@@ -500,7 +500,7 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd)
msg.Printf(wxT("Memory leak: {wx_ref, %d, %s}"),
refd->ref, cinfo->GetClassName());
send_msg("error", &msg);
- } else {
+ } else if(refd->type != 4) {
cleanup_ref = delete_object(ptr, refd);
}
if(cleanup_ref) {
@@ -562,7 +562,12 @@ int WxeApp::newPtr(void * ptr, int type, wxeMemEnv *memenv) {
if(wxe_debug) {
wxString msg;
- msg.Printf(wxT("Creating {wx_ref, %d, unknown} at %p "), ref, ptr);
+ const wxChar *class_info = wxT("unknown");
+ if(type < 10) {
+ wxClassInfo *cinfo = ((wxObject *)ptr)->GetClassInfo();
+ class_info = cinfo->GetClassName();
+ }
+ msg.Printf(wxT("Creating {wx_ref, %d, %s} at %p "), ref, class_info, ptr);
send_msg("debug", &msg);
}
@@ -614,12 +619,6 @@ void WxeApp::clearPtr(void * ptr) {
refd->memenv->ref2ptr[ref] = NULL;
free.Append(ref);
- if(wxe_debug) {
- wxString msg;
- msg.Printf(wxT("Deleting {wx_ref, %d, unknown} at %p "), ref, ptr);
- send_msg("debug", &msg);
- }
-
if(((int) refd->pid) != -1) {
// Send terminate pid to owner
wxeReturn rt = wxeReturn(WXE_DRV_PORT,refd->pid, false);