lmi
[Top][All Lists]
Advanced

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

[lmi] wx segfault iterating on GetChildren()


From: Greg Chicares
Subject: [lmi] wx segfault iterating on GetChildren()
Date: Sat, 11 Mar 2006 13:07:27 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Vadim--have you any idea why this segfaults?

I have code like this for a wxNotebook:

    wxNotebookPage* page = notebook.GetPage(notebook.GetSelection());
    if(!page)
        throw ...
    wxWindowList wl = page->GetChildren();
    if(wl.IsEmpty)
        throw ...
    for(wxWindowList::const_iterator i = wl.begin(); i != wl.end(); ++i)

inside an EVT_CHILD_FOCUS handler, and it's segfaulting on
construction of the const_iterator. I thought one could
always construct a std::iterator even from an empty list.

This occurs only in an unusual situation: I'm testing an
EVT_NOTEBOOK_PAGE_CHANGING handler that always vetoes
every page change--even the first page "change" triggered
by creation of the notebook. That may seem a strange thing
to test, but I'm trying to test strange things in order to
make sure they get handled appropriately. Probably I'll
have to add special logic to prevent vetoing a page change
if IsShown() returns false.

Still, this seems very strange:

Program received signal SIGSEGV, Segmentation fault.
XmlNotebook::EnsureOptimalFocus (this=0x22edc4)
    at /MinGW-20050120//bin/../lib/gcc/mingw32/3.4.2/../../../../\
include/c++/3.4.2/bits/stl_list.h:201
201           : _M_node(__x) { }
Current language:  auto; currently c++
(gdb) bt
#0  XmlNotebook::EnsureOptimalFocus (this=0x22edc4)
    at /MinGW-20050120//bin/../lib/gcc/mingw32/3.4.2/../../../../\
include/c++/3.4.2/bits/stl_list.h:201

C:/MinGW-20050120/include/c++/3.4.2/bits[0]$less -N stl_list.h
199
200        _List_const_iterator(const _List_node_base* __x)
201        : _M_node(__x) { }
202




reply via email to

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