I’m getting infrequent, but persistent reports from users who are experiencing segmentation faults when running one of my WxPython applications. Everyone is on RHEL 6 x64 with 64-bit Python 2.7.5. We had been running WxPython 2.9.5, and users were hitting a segmentation fault with the following stack trace:
#0 0x00007f749fdbf487 in SurfaceImpl::BrushColour(ColourDesired) () from /opt/goes/lib/libwx_gtk2u_stc-2.9.so.5
#1 0x00007f749fdbf738 in SurfaceImpl::FillRectangle(PRectangle, ColourDesired) () from /opt/goes/lib/libwx_gtk2u_stc-2.9.so.5
#2 0x00007f749fddb8cb in Editor::PaintSelMargin(Surface*, PRectangle&) () from /opt/goes/lib/libwx_gtk2u_stc-2.9.so.5
#3 0x00007f749fde9246 in Editor::Paint(Surface*, PRectangle) () from /opt/goes/lib/libwx_gtk2u_stc-2.9.so.5
#4 0x00007f749fdc3f99 in ScintillaWX::DoPaint(wxDC*, wxRect) () from /opt/goes/lib/libwx_gtk2u_stc-2.9.so.5
#5 0x00007f749fdb2da3 in wxStyledTextCtrl::OnPaint(wxPaintEvent&) () from /opt/goes/lib/libwx_gtk2u_stc-2.9.so.5
#6 0x00007f74a944b4ac in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from /opt/goes/lib/libwx_baseu-2.9.so.5
#7 0x00007f74a944c45b in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /opt/goes/lib/libwx_baseu-2.9.so.5
#8 0x00007f74a944c52a in wxEvtHandler::TryHereOnly(wxEvent&) () from /opt/goes/lib/libwx_baseu-2.9.so.5
#9 0x00007f74a944cb33 in wxEvtHandler::ProcessEventLocally(wxEvent&) () from /opt/goes/lib/libwx_baseu-2.9.so.5
#10 0x00007f74a944cb95 in wxEvtHandler::ProcessEvent(wxEvent&) () from /opt/goes/lib/libwx_baseu-2.9.so.5
#11 0x00007f74a944beeb in wxEvtHandler::SafelyProcessEvent(wxEvent&) () from /opt/goes/lib/libwx_baseu-2.9.so.5
#12 0x00007f74a9bb4042 in wxWindow::GTKSendPaintEvents(_GdkRegion const*) () from /opt/goes/lib/libwx_gtk2u_core-2.9.so.5
#13 0x00007f74a9bb465c in expose_event () from /opt/goes/lib/libwx_gtk2u_core-2.9.so.5
I decided to upgrade to 3.0.0 since it bundles a newer version of Scintilla. Unfortunately, I just had a couple reports of seg faults with a very similar signature after upgrading to 3.0.0:
#0 0x0000000000000000 in ?? ()
#1 0x00007fa08d32f833 in wxWindowDCImpl::DoDrawRectangle(int, int, int, int) () from /opt/goes/lib/libwx_gtk2u_core-3.0.so.0
#2 0x00007fa083535b9a in Editor::RefreshPixMaps(Surface*) () from /opt/goes/lib/libwx_gtk2u_stc-3.0.so.0
#3 0x00007fa08354a4b5 in Editor::Paint(Surface*, PRectangle) () from /opt/goes/lib/libwx_gtk2u_stc-3.0.so.0
#4 0x00007fa083525349 in ScintillaWX::DoPaint(wxDC*, wxRect) () from /opt/goes/lib/libwx_gtk2u_stc-3.0.so.0
#5 0x00007fa083513f93 in wxStyledTextCtrl::OnPaint(wxPaintEvent&) () from /opt/goes/lib/libwx_gtk2u_stc-3.0.so.0
#6 0x00007fa08cbb36ec in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from /opt/goes/lib/libwx_baseu-3.0.so.0
#7 0x00007fa08cbb469b in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /opt/goes/lib/libwx_baseu-3.0.so.0
#8 0x00007fa08cbb476a in wxEvtHandler::TryHereOnly(wxEvent&) () from /opt/goes/lib/libwx_baseu-3.0.so.0
#9 0x00007fa08cbb4d73 in wxEvtHandler::ProcessEventLocally(wxEvent&) () from /opt/goes/lib/libwx_baseu-3.0.so.0
#10 0x00007fa08cbb4dd5 in wxEvtHandler::ProcessEvent(wxEvent&) () from /opt/goes/lib/libwx_baseu-3.0.so.0
#11 0x00007fa08cbb412b in wxEvtHandler::SafelyProcessEvent(wxEvent&) () from /opt/goes/lib/libwx_baseu-3.0.so.0
#12 0x00007fa08d322d92 in wxWindow::GTKSendPaintEvents(_GdkRegion const*) () from /opt/goes/lib/libwx_gtk2u_core-3.0.so.0
I currently use 3 different widgets based off StyledTextCtrl. The errors are very difficult to reproduce and only occur after many successful runs, so I’m not real sure how to track this one down. Any ideas what’s causing this?