lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] wx segfault iterating on GetChildren()


From: Greg Chicares
Subject: Re: [lmi] wx segfault iterating on GetChildren()
Date: Sun, 12 Mar 2006 13:04:05 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

[redirecting this to the mailing list, because the discussion
has shifted back to the actual work as opposed to financing it]

On 2006-3-12 0:42 UTC, Vadim Zeitlin wrote:
> On Sat, 11 Mar 2006 20:38:14 +0000 Greg Chicares <address@hidden> wrote:
>
> GC> I have wxUSE_STL=1. That may be crucial.
>
>  I've tried with wxUSE_STL=1 but still couldn't reproduce it.
>
> GC> The most important thing is to have a static EVT_NOTEBOOK_PAGE_CHANGING
> GC> handler that always does 'event.Veto();'--that's the only way I've ever
> GC> seen this problem. But I didn't see 'Veto' in the code I snipped above.
>
>  I've tried adding it without success...

To reproduce it in lmi HEAD, add one line in 'xml_notebook.cpp':

  void XmlNotebook::UponPageChanging(wxNotebookEvent& event)
  {
+ event.Veto(); // This should cause a segfault.
      // Do nothing until the notebook has been fully created.
      if(updates_blocked_)

Then rebuild, run, and do 'File | New | Illustration'.

Now this is interesting. Yesterday, I was working on a different
branch with some local modifications, but with HEAD, I get:

  gdb: Target exception EXCEPTION_ACCESS_VIOLATION at 0x103b0ae2

  Program received signal SIGSEGV, Segmentation fault.
  0x103b0ae2 in wxWindowBase::GetExtraStyle (this=0x180702)
      at ../../include/wx/window.h:473
  473         long GetExtraStyle() const { return m_exStyle; }

This seems to suggest memory corruption. Looking a few levels
into the backtrace:

  (gdb) bt
  #0  0x103b0ae2 in wxWindowBase::GetExtraStyle (this=0x180702)
      at ../../include/wx/window.h:473
  #1  0x101e0947 in wxWindowBase::TransferDataToWindow (this=0x180702)
      at ../../src/common/wincmn.cpp:1441
  #2  0x0042e049 in XmlNotebook::TransferDataToWindow (this=0x22d894)
      at C:/lmi/src/lmi/xml_notebook.cpp:834
  #3  0x00430214 in XmlNotebook::UponInitDialog (this=0x22d894)
      at C:/lmi/src/lmi/xml_notebook.cpp:581

Here's an additional change that prevents that particular segfault:

  wxNotebookPage& XmlNotebook::CurrentPage() const
  {
      // INELEGANT !! This window could be held elsewhere, e.g. as a reference.
      wxNotebook& notebook = WindowFromXrcName<wxNotebook>("input_notebook");
+     if(-1 == notebook.GetSelection())
+         {
+         fatal_error() << "No page selected in notebook." << LMI_FLUSH;
+         }
      wxNotebookPage* page = notebook.GetPage(notebook.GetSelection());
      if(!page)
          {
-         fatal_error() << "No page selected in notebook." << LMI_FLUSH;
+          fatal_error() << "Selected notebook page is null." << LMI_FLUSH;
          }
      return *page;
  }

However, there's still a segfault upon exit.

> GC> I'm using wx-2.5.4, but I don't imagine that's crucial.
>
>  This could very well be. There were a lot of bug fixes in wxUSE_STL=1
> build (as this code is new it was natural that there were more bugs in it
> initially) since then and I'm testing with 2.7.0 (a.k.a. current cvs HEAD).
>
>  What is holding you from upgrading to it or at least 2.6.2? I'm sure it's
> not going to be the last problem which could be solved by simply upgrading.

What's holding me back is mpatrol.

If mpatrol worked nicely with lmi, even with wx-2.5.4, then
problems like this would probably be much easier to solve.

It worked nicely with wx-2.5.1 and mingw gcc-3.2.3 . Then,
about a year ago, we upgraded both wx and gcc at the same
time, and mpatrol is no longer usable. The problem very well
might be gcc:
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196
but the mingw project hasn't yet released a version with that
fixed, although they apparently hope to someday.

I tried building wx-2.5.4 with mingw gcc-3.2.3, but that didn't
work very well, as described below [1]. By commenting out all
use of wxHTML in the source, I got results that seemed promising.
But I did that only in the (small) 'skeleton' branch; to get it
up and running in the (much larger) 'lmi' branch that we use for
production might be more difficult. And it wouldn't actually be
useful anyway, because we depend on wxHTML.

I'm keeping wx-2.5.1 for now, just so that I have a way of using
lmi for at least the 'skeleton' branch. We're using wx-2.5.4 in
production. If I add wx HEAD or wx-2.6.2, then that's three
different wx versions I need--at least for a month or two while
we test a new version for production. That would make my work
more difficult, so I'm trying to avoid it, even though I realize
we'll need a recent version of wx for the product editor.

Maybe there's a way through this maze, though: does wx-2.6.2 or
HEAD build with mingw gcc-3.2.3? If it does, then at least I
could test it with mpatrol, and that would tell us whether the
mpatrol problem is in gcc; then maybe I could get rid of all my
old versions of wx, and still have mpatrol.

---------
[1] Try building 2.5.4 with gcc-3.2.3 (MinGW-20030915)

wx source is unmodified except for
  include/wx/msw/wrapwin.h
  NOMINMAX patch from VZ

// don't define min() and max() as macros, they conflict with standard C++ ones
#ifndef NOMINMAX
#   define NOMINMAX
#endif // NOMINMAX


C:\wxWidgets-2.5.4x\build\msw>Path=C:\WINNT\system32;C:\WINNT;C:\MinGW-20030915\
bin

C:\wxWidgets-2.5.4x\build\msw>\usr\bin\make --keep-going -f makefile.gcc SHARED=
1 MONOLITHIC=1 CXXFLAGS="-DNO_GCC_PRAGMA -ggdb" >buildlog-20060107 2>&1

OK, but:

/MinGW-20030915//bin/g++ -o skeleton.exe about_dialog.o alert.o alert_wx.o 
datum_base.o datum_boolean.o datum_string.o docmanager_ex.o 
docmdichildframe_ex.o facets.o
getopt.o html_doc.o html_view.o input.o license.o main_wx.o mc_enum.o 
mc_enum_types.o mvc_test.o previewframe_ex.o text_doc.o text_view.o 
tn_range_types.o transferor.o
view_ex.o wx_checks.o xml_notebook.o lmi.rc.o wx_new.dll -L 
/mpatrol/mpatrol/build/MinGW-20030915 -L /wxWindows-2.5.4x/lib/gcc_dll -L . -L 
C:/opt/lmi/third_party/lib -L
C:/opt/lmi/third_party/bin -L C:/usr/local/lib -L C:/usr/local/bin -lwx_new 
-lwxmsw25d  -mwindows  -lboost_filesystem-mgw  -lxmlwrapp -lxml2.dll   
-lmpatrol -lbfd -liberty
-limagehlp   -Wl,-Map,skeleton.exe.map
about_dialog.o(.data$_ZTV12wxHtmlWindow+0x2c8): In function 
`ZN11AboutDialogC2EP8wxWindow':
C:/lmi/src/skeleton/about_dialog.cpp:73: undefined reference to `non-virtual 
thunk to wxHtmlWindow::~wxHtmlWindow()'
about_dialog.o(.data$_ZTV12wxHtmlWindow+0x2cc):C:/lmi/src/skeleton/about_dialog.cpp:73:
 undefined reference to `non-virtual thunk to wxHtmlWindow::~wxHtmlWindow()'
about_dialog.o(.data$_ZTV23wxGenericScrolledWindow+0x2a4):C:/lmi/src/skeleton/about_dialog.cpp:73:
 undefined reference to `non-virtual thunk to
wxGenericScrolledWindow::~wxGenericScrolledWindow()'
about_dialog.o(.data$_ZTV23wxGenericScrolledWindow+0x2a8):C:/lmi/src/skeleton/about_dialog.cpp:73:
 undefined reference to `non-virtual thunk to
wxGenericScrolledWindow::~wxGenericScrolledWindow()'
make.EXE[1]: *** [skeleton.exe] Error 1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]