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: Evgeniy Tarassov
Subject: Re: [lmi] wx segfault iterating on GetChildren()
Date: Thu, 16 Mar 2006 23:44:36 +0100

Hello Greg!
Vadim has asked me to check if the tuple
mpatrol+mingw(gcc3.2.3)+wxWidget2.6.2
allows to compile lmi.
It does work with almost no problems/workarounds.

The package versions i've used:
1. msys+mingw
The 'Previous' distribution on the mingw website
    gcc3.2.3, msysDTK1.0.10, MSYS1.0.9, Mingw3.1.0-1
plus a couple of packages from 'Current' distrubution (because either
the supplied one with 'Previous' was not functional, or missing)
    wget, msys-autotools, gdb

2. wxWidgets2.6.2 ('all ports combined' version)
when compiling wxWidgets i've used options from README.auto document
file of lmi.

3. mpatrol
The one described in the INSTALL document of lmi


Minor problems:
1. when trying to get mpatrol to link even to a hello world i got
'symbol undefined error' for SymGetModuleInfo routines defined in
GbdHelp.lid(dll), and i did'nt managed to get it work. But after
defining DYNLINK to DYNLINK_NONE in mpatrol/src/target.h file and
recompiling mpatrol it did it.
2. fatal_error() function does not seem to work as intended. Any time
it is being called it produces exception 'basic_ios::clear(iostate)
caused exception' which is shown through wxSafeShowMessage and initial
diagnostic message is lost.

Notes:
1. when using autotools with gcc3.2.3 i've noticed that -Wendif-labels
isn't a legal switch (for gcc 3.2.3) and should be added
conditionally.
2. mpatrol.m4 (mpatrol configuration script) is outdated and needed to
be fixed to correctly work with current msys autotools (the patch in
attachment)

To make sure that mpatrol is linked into an executable (lmi_wx.exe) i
have defined (as described in mpatrol docs) MPATROL_OPTIONS
environment variable to LOGALL and checked that mpatrol.log is being
created by the program.

I will try to understand what happens with fatal_error().
As my experience with mpatrol is equal to zero i wanted to ask you if
you know any 'polite' way of configuring mpatrol instead of hacking
into its headers. Thank you in advance!

Evgeniy


=== mpatrol.m4.patch ===
*** C:\msys323\share\aclocal\mpatrol.m4 Tue Jan  8 21:30:57 2002
--- mpatrol/extra/mpatrol.m4    Thu Mar 16 23:35:20 2006
***************
*** 35,39 ****
  # library will be used.

! AC_DEFUN(AM_WITH_MPATROL, [
    # Firstly, determine if the mpatrol library should be used.

--- 35,39 ----
  # library will be used.

! AC_DEFUN([AM_WITH_MPATROL], [
    # Firstly, determine if the mpatrol library should be used.

***************
*** 161,171 ****

     AC_CACHE_CHECK(for working mpatrol, am_cv_with_mpatrol, [
!      AC_TRY_LINK([#include <mpatrol.h>], [
! int main(void)
! {
!     malloc(4);
!     return EXIT_SUCCESS;
! }
! ],
        [am_cv_with_mpatrol=yes],
        [am_cv_with_mpatrol=no]
--- 161,165 ----

     AC_CACHE_CHECK(for working mpatrol, am_cv_with_mpatrol, [
!      AC_TRY_LINK([#include <mpatrol.h>], [malloc(4);],
        [am_cv_with_mpatrol=yes],
        [am_cv_with_mpatrol=no]
=== end of mpatrol.m4.patch ===


On 3/12/06, Greg Chicares <address@hidden> wrote:
> [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
>
>
> _______________________________________________
> lmi mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lmi
>




reply via email to

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