madedit segfault

3 views
Skip to first unread message

Nerijus Baliunas

unread,
Nov 21, 2009, 1:55:44 PM11/21/09
to wx-u...@googlegroups.com
Hello,

I compiled madedit with svn wx 2.8, but it segfaults:

#0 0x080d2975 in wxMemoryDCBase::SelectObject (this=0xbfffdf74, bmp=...)
at /a/M/wxWindows.28/wxWidgets/include/wx/dcmemory.h:35
#1 0x080f6525 in MadEdit::OnPaint (this=0x8839758, evt=...) at src/MadEdit/MadEdit.cpp:9742
#2 0xb7a3ee6e in wxAppConsole::HandleEvent (this=0x8387d50, handler=0x8839758, func=
(void (wxEvtHandler::*)(wxEvtHandler *, wxEvent &)) 0x80f63be <MadEdit::OnPaint(wxPaintEvent&)>, event=...) at ../wxWidgets/src/common/appbase.cpp:322
#3 0xb7af3f7d in wxEvtHandler::ProcessEventIfMatches (entry=..., handler=0x8839758, event=...)
at ../wxWidgets/src/common/event.cpp:1239
#4 0xb7af2f35 in wxEventHashTable::HandleEvent (this=0x831f210, event=..., self=0x8839758)
at ../wxWidgets/src/common/event.cpp:906
#5 0xb7af419d in wxEvtHandler::ProcessEvent (this=0x8839758, event=...)
at ../wxWidgets/src/common/event.cpp:1301
#6 0xb7d26c15 in wxWindow::GtkSendPaintEvents (this=0x8839758)
at ../wxWidgets/src/gtk/window.cpp:3878

MadEdit.cpp line 9742 is:
memdc.SelectObject(*m_ClientBitmap);

Any ideas why does it happen?
Could it be because of an upgrade from gtk2 2.16 to 2.18?

Regards,
Nerijus

Vadim Zeitlin

unread,
Nov 22, 2009, 6:13:37 AM11/22/09
to wx-u...@googlegroups.com
On Sat, 21 Nov 2009 20:55:44 +0200 Nerijus Baliunas <ner...@users.sourceforge.net> wrote:

NB> I compiled madedit with svn wx 2.8, but it segfaults:
NB>
NB> #0 0x080d2975 in wxMemoryDCBase::SelectObject (this=0xbfffdf74, bmp=...)
NB> at /a/M/wxWindows.28/wxWidgets/include/wx/dcmemory.h:35
NB> #1 0x080f6525 in MadEdit::OnPaint (this=0x8839758, evt=...) at src/MadEdit/MadEdit.cpp:9742
NB> #2 0xb7a3ee6e in wxAppConsole::HandleEvent (this=0x8387d50, handler=0x8839758, func=
NB> (void (wxEvtHandler::*)(wxEvtHandler *, wxEvent &)) 0x80f63be <MadEdit::OnPaint(wxPaintEvent&)>, event=...) at ../wxWidgets/src/common/appbase.cpp:322
NB> #3 0xb7af3f7d in wxEvtHandler::ProcessEventIfMatches (entry=..., handler=0x8839758, event=...)
NB> at ../wxWidgets/src/common/event.cpp:1239
NB> #4 0xb7af2f35 in wxEventHashTable::HandleEvent (this=0x831f210, event=..., self=0x8839758)
NB> at ../wxWidgets/src/common/event.cpp:906
NB> #5 0xb7af419d in wxEvtHandler::ProcessEvent (this=0x8839758, event=...)
NB> at ../wxWidgets/src/common/event.cpp:1301
NB> #6 0xb7d26c15 in wxWindow::GtkSendPaintEvents (this=0x8839758)
NB> at ../wxWidgets/src/gtk/window.cpp:3878
NB>
NB> MadEdit.cpp line 9742 is:
NB> memdc.SelectObject(*m_ClientBitmap);
NB>
NB> Any ideas why does it happen?

Frankly none at all. Why does it segfault exactly though? I.e. where in
SelectObject() does it crash? Can you recompile with debug info to see it?

NB> Could it be because of an upgrade from gtk2 2.16 to 2.18?

I have no idea what could have changed in GTK+ to explain this but OTOH if
it worked with with previous 2.8.x releases then I don't see what could
have changed in 2.8 to explain this neither...

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

Nerijus Baliunas

unread,
Nov 22, 2009, 8:05:55 AM11/22/09
to wx-u...@googlegroups.com
On Sun, 22 Nov 2009 12:13:37 +0100 Vadim Zeitlin <va...@wxwidgets.org> wrote:

> Frankly none at all. Why does it segfault exactly though? I.e. where in
> SelectObject() does it crash? Can you recompile with debug info to see it?

wx is compiled with --enable-debug. Should I add --enable-debug_gdb?

Regards,
Nerijus

Vadim Zeitlin

unread,
Nov 23, 2009, 11:28:41 AM11/23/09
to wx-u...@googlegroups.com
On Sun, 22 Nov 2009 15:05:55 +0200 Nerijus Baliunas <ner...@users.sourceforge.net> wrote:

NB> On Sun, 22 Nov 2009 12:13:37 +0100 Vadim Zeitlin <va...@wxwidgets.org> wrote:
NB>
NB> > Frankly none at all. Why does it segfault exactly though? I.e. where in
NB> > SelectObject() does it crash? Can you recompile with debug info to see it?
NB>
NB> wx is compiled with --enable-debug. Should I add --enable-debug_gdb?

No, --enable-debug is enough. So you should be able to see where does it
crash. If the line 35 is the same as in my 2.8 svn sources then it must
mean that bmp itself is invalid, can you do "print bmp" in gdb to see what
does it look like?

Nerijus Baliunas

unread,
Nov 23, 2009, 12:20:59 PM11/23/09
to wx-u...@googlegroups.com
On Mon, 23 Nov 2009 17:28:41 +0100 Vadim Zeitlin <va...@wxwidgets.org> wrote:

VZ> No, --enable-debug is enough. So you should be able to see where does it
VZ> crash. If the line 35 is the same as in my 2.8 svn sources then it must
VZ> mean that bmp itself is invalid, can you do "print bmp" in gdb to see what
VZ> does it look like?

(gdb) print bmp
$1 = (wxBitmap &) @0x0: <error reading variable>

But why does it crash if bmp is invalid?

Regards,
Nerijus

Nerijus Baliunas

unread,
Nov 23, 2009, 3:06:36 PM11/23/09
to wx-u...@googlegroups.com
On Mon, 23 Nov 2009 19:20:59 +0200 Nerijus Baliunas <ner...@users.sourceforge.net> wrote:

NB> VZ> No, --enable-debug is enough. So you should be able to see where does it
NB> VZ> crash. If the line 35 is the same as in my 2.8 svn sources then it must
NB> VZ> mean that bmp itself is invalid, can you do "print bmp" in gdb to see what
NB> VZ> does it look like?
NB>
NB> (gdb) print bmp
NB> $1 = (wxBitmap &) @0x0: <error reading variable>

I found out that madedit works if I open only one file. It crashes when I open 2nd tab.

Regards,
Nerijus

Vadim Zeitlin

unread,
Nov 23, 2009, 3:19:52 PM11/23/09
to wx-u...@googlegroups.com
On Mon, 23 Nov 2009 22:06:36 +0200 Nerijus Baliunas <ner...@users.sourceforge.net> wrote:

NB>

NB> On Mon, 23 Nov 2009 19:20:59 +0200 Nerijus Baliunas <ner...@users.sourceforge.net> wrote:
NB>

NB> NB> VZ> No, --enable-debug is enough. So you should be able to see where does it
NB> NB> VZ> crash. If the line 35 is the same as in my 2.8 svn sources then it must
NB> NB> VZ> mean that bmp itself is invalid, can you do "print bmp" in gdb to see what
NB> NB> VZ> does it look like?


NB> NB>
NB> NB> (gdb) print bmp

NB> NB> $1 = (wxBitmap &) @0x0: <error reading variable>

There is a problem somewhere above then as a reference (which bmp is here)
can't be NULL. Where does this DC come from in MadEdit::OnPaint()?

NB> I found out that madedit works if I open only one file. It crashes when
NB> I open 2nd tab.

Sorry, I know nothing at all about MadEdit so I can't hazard any guess
about what could opening the 2nd tab change.

Reply all
Reply to author
Forward
0 new messages