aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src/gen
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2013-12-20 09:20:22 +0100
committerDan Gudmundsson <[email protected]>2014-01-14 13:26:53 +0100
commit74f6d6d74f7a3be5aece37a0b419e40d96e036d4 (patch)
tree73ffc54f3b8b9b827f6f2a9aedd46b566dce7ffa /lib/wx/c_src/gen
parent3f9b80b1e635f3b5f39bd7380b3bd777ebd98338 (diff)
downloadotp-74f6d6d74f7a3be5aece37a0b419e40d96e036d4.tar.gz
otp-74f6d6d74f7a3be5aece37a0b419e40d96e036d4.tar.bz2
otp-74f6d6d74f7a3be5aece37a0b419e40d96e036d4.zip
wx: Fix crash when garbage collect event handlers (debugger caused seg fault)
wxStyledTextCtrl had no wrapper class so, because it was not detected that it had virtual destructors, thus references to it was not cleaned up on destruction. When a process dies and wx cleans up the event handlers access was made to the deleted object and caused a seg fault. Added a testcase which I thought could provoke the bug but didn't.
Diffstat (limited to 'lib/wx/c_src/gen')
-rw-r--r--lib/wx/c_src/gen/wxe_derived_dest.h6
-rw-r--r--lib/wx/c_src/gen/wxe_funcs.cpp8
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/wx/c_src/gen/wxe_derived_dest.h b/lib/wx/c_src/gen/wxe_derived_dest.h
index 8dcaf1c1ac..7e2d4524cb 100644
--- a/lib/wx/c_src/gen/wxe_derived_dest.h
+++ b/lib/wx/c_src/gen/wxe_derived_dest.h
@@ -736,6 +736,12 @@ class EwxPrintout : public wxPrintout {
EwxPrintout(const wxString& title) : wxPrintout(title) {};
};
+class EwxStyledTextCtrl : public wxStyledTextCtrl {
+ public: ~EwxStyledTextCtrl() {((WxeApp *)wxTheApp)->clearPtr(this);};
+ EwxStyledTextCtrl(wxWindow * parent,wxWindowID id,const wxPoint& pos,const wxSize& size,long style) : wxStyledTextCtrl(parent,id,pos,size,style) {};
+ EwxStyledTextCtrl() : wxStyledTextCtrl() {};
+};
+
class EwxClipboard : public wxClipboard {
public: ~EwxClipboard() {((WxeApp *)wxTheApp)->clearPtr(this);};
EwxClipboard() : wxClipboard() {};
diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp
index b5fbac3fe0..329af36f4d 100644
--- a/lib/wx/c_src/gen/wxe_funcs.cpp
+++ b/lib/wx/c_src/gen/wxe_funcs.cpp
@@ -26953,14 +26953,14 @@ case wxStyledTextCtrl_new_2: { // wxStyledTextCtrl::wxStyledTextCtrl
style = (long)*(int *) bp; bp += 4;
} break;
}};
- wxStyledTextCtrl * Result = new wxStyledTextCtrl(parent,id,pos,size,style);
- /* Possible memory leak here, class is missing virt dest */
+ wxStyledTextCtrl * Result = new EwxStyledTextCtrl(parent,id,pos,size,style);
+ newPtr((void *) Result, 0, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxStyledTextCtrl");
break;
}
case wxStyledTextCtrl_new_0: { // wxStyledTextCtrl::wxStyledTextCtrl
- wxStyledTextCtrl * Result = new wxStyledTextCtrl();
- /* Possible memory leak here, class is missing virt dest */
+ wxStyledTextCtrl * Result = new EwxStyledTextCtrl();
+ newPtr((void *) Result, 0, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxStyledTextCtrl");
break;
}