diff options
author | Dan Gudmundsson <dgud@erlang.org> | 2015-06-30 12:53:02 +0200 |
---|---|---|
committer | Dan Gudmundsson <dgud@erlang.org> | 2015-06-30 12:53:02 +0200 |
commit | 4246d988b53947c7a7f0ce4943a83af38d129435 (patch) | |
tree | f6e2859c8e9d0e55e5ae76f7c460cca2c0c1972a /lib/wx | |
parent | 46285b9f6f9cbe102e22aaf6157e436797404f00 (diff) | |
download | otp-4246d988b53947c7a7f0ce4943a83af38d129435.tar.gz otp-4246d988b53947c7a7f0ce4943a83af38d129435.tar.bz2 otp-4246d988b53947c7a7f0ce4943a83af38d129435.zip |
wx: Send wxWdigets assert to error logger
Instead of popping up an annoying msgbox
Diffstat (limited to 'lib/wx')
-rw-r--r-- | lib/wx/c_src/wxe_impl.cpp | 19 | ||||
-rw-r--r-- | lib/wx/c_src/wxe_impl.h | 5 | ||||
-rw-r--r-- | lib/wx/test/wx_class_SUITE.erl | 6 |
3 files changed, 29 insertions, 1 deletions
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp index 6236fb708e..e6ed236962 100644 --- a/lib/wx/c_src/wxe_impl.cpp +++ b/lib/wx/c_src/wxe_impl.cpp @@ -181,6 +181,25 @@ void WxeApp::dummy_close(wxEvent& Ev) { // windows open, and this will kill the erlang, override default handling } +void WxeApp::OnAssertFailure(const wxChar *file, int line, const wxChar *cfunc, + const wxChar *cond, const wxChar *cmsgUser) { + wxString msg; + wxString func(cfunc); + wxString msgUser(cmsgUser); + + msg.Printf(wxT("wxWidgets Assert failure: %s(%d): \"%s\""), + file, line, cond); + if ( !func.empty() ) { + msg << wxT(" in ") << func << wxT("()"); + } + // and the message itself + if ( !msgUser.empty() ) { + msg << wxT(" : ") << msgUser; + } + + send_msg("error", &msg); +} + // Called by wx thread void WxeApp::idle(wxIdleEvent& event) { event.Skip(true); diff --git a/lib/wx/c_src/wxe_impl.h b/lib/wx/c_src/wxe_impl.h index d8241d11a4..d6d3095a0f 100644 --- a/lib/wx/c_src/wxe_impl.h +++ b/lib/wx/c_src/wxe_impl.h @@ -57,9 +57,14 @@ class WxeApp : public wxApp { public: virtual bool OnInit(); + + virtual void OnAssertFailure(const wxChar *file, int line, const wxChar *func, + const wxChar *cond, const wxChar *msg); + #ifdef _MACOSX virtual void MacOpenFile(const wxString &filename); #endif + void shutdown(wxeMetaCommand& event); int dispatch(wxeFifo *, int, int); diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl index fd6023a820..ebae32aeb8 100644 --- a/lib/wx/test/wx_class_SUITE.erl +++ b/lib/wx/test/wx_class_SUITE.erl @@ -386,13 +386,17 @@ listCtrlSort(Config) -> io:format("Sorted ~p ~n",[Time]), Item = wxListItem:new(), + + %% Force an assert on (and debug compiled) which 3.0 is by default + wxListItem:setId(Item, 200), + io:format("Got ~p ~n", [wxListCtrl:getItem(LC, Item)]), + wxListItem:setMask(Item, ?wxLIST_MASK_TEXT), _List = wx:map(fun(Int) -> wxListItem:setId(Item, Int), ?m(true, wxListCtrl:getItem(LC, Item)), io:format("~p: ~s~n",[Int, wxListItem:getText(Item)]) end, lists:seq(0,10)), - wxListItem:destroy(Item), wx_test_lib:wx_destroy(Frame,Config). |