wxWidgets exit loop problem

293 views
Skip to first unread message

Keith Poole

unread,
Jul 29, 2011, 2:16:06 AM7/29/11
to wx-u...@googlegroups.com
Hey people,

I've had an odd problem with wxWidgets recently.

Before I get into it, quick specs: Ubuntu 10.04.3 LTS i386, GCC 4.5.3, wxWidgets 2.9.0.

Suddenly we've had the program terminating abnormally with:
*** Caught unhandled unknown exception; terminating

Doing a gdb and backtrace shows the following:
[ snip -- repeats all the way to #1 ]
#163767 0x00d34ecf in wxMBConv::WC2MB (this=0x16844d0, outBuff=0x0, inBuff=0x821c010 L"/home/keith/Desura", outLen=0) at ./src/common/strconv.cpp:371
#163768 0x00d34d4a in wxMBConv::FromWChar (this=0x16844d0, dst=0x0, dstLen=0, src=0x821c010 L"/home/keith/Desura", srcLen=19) at ./src/common/strconv.cpp:330
#163769 0x00d34ecf in wxMBConv::WC2MB (this=0x16844d0, outBuff=0x0, inBuff=0x821c010 L"/home/keith/Desura", outLen=0) at ./src/common/strconv.cpp:371
#163770 0x00d34d4a in wxMBConv::FromWChar (this=0x16844d0, dst=0x0, dstLen=0, src=0x821c010 L"/home/keith/Desura", srcLen=19) at ./src/common/strconv.cpp:330
#163771 0x00d34ecf in wxMBConv::WC2MB (this=0x16844d0, outBuff=0x0, inBuff=0x821c010 L"/home/keith/Desura", outLen=0) at ./src/common/strconv.cpp:371
#163772 0x00d34d4a in wxMBConv::FromWChar (this=0x16844d0, dst=0x0, dstLen=0, src=0x821c010 L"/home/keith/Desura", srcLen=19) at ./src/common/strconv.cpp:330
#163773 0x00d34ecf in wxMBConv::WC2MB (this=0x16844d0, outBuff=0x0, inBuff=0x821c010 L"/home/keith/Desura", outLen=0) at ./src/common/strconv.cpp:371
#163774 0x00d34d4a in wxMBConv::FromWChar (this=0x16844d0, dst=0x0, dstLen=0, src=0x821c010 L"/home/keith/Desura", srcLen=19) at ./src/common/strconv.cpp:330
#163775 0x00d34ecf in wxMBConv::WC2MB (this=0x16844d0, outBuff=0x0, inBuff=0x821c010 L"/home/keith/Desura", outLen=0) at ./src/common/strconv.cpp:371
#163776 0x00d34d4a in wxMBConv::FromWChar (this=0x16844d0, dst=0x0, dstLen=0, src=0x821c010 L"/home/keith/Desura", srcLen=19) at ./src/common/strconv.cpp:330
#163777 0x00d34ecf in wxMBConv::WC2MB (this=0x16844d0, outBuff=0x0, inBuff=0x821c010 L"/home/keith/Desura", outLen=0) at ./src/common/strconv.cpp:371
#163778 0x00d34d4a in wxMBConv::FromWChar (this=0x16844d0, dst=0x0, dstLen=0, src=0x821c010 L"/home/keith/Desura", srcLen=18) at ./src/common/strconv.cpp:330
#163779 0x00d3fb10 in wxString::AsChar (this=0x81c8908, conv=...) at ./src/common/string.cpp:535
#163780 0x00cdee18 in wxString::AsCharBuf (this=0x81c8908, conv=...) at ./include/wx/string.h:3513
#163781 0x00cded98 in wxString::mb_str (this=0x81c8908, conv=...) at ./include/wx/string.h:1813
---Type <return> to continue, or q <return> to quit---
#163782 0x00cec4a7 in wxString::fn_str (this=0x81c8908) at ./include/wx/string.h:1830
#163783 0x00d7e640 in wxSingleInstanceCheckerImpl::Unlock (this=0x81c8900) at ./src/unix/snglinst.cpp:321
#163784 0x00d7ed5a in ~wxSingleInstanceCheckerImpl (this=0x81c8900, __in_chrg=<value optimized out>) at ./src/unix/snglinst.cpp:124
#163785 0x00d7ec84 in ~wxSingleInstanceChecker (this=0x81c3b88, __in_chrg=<value optimized out>) at ./src/unix/snglinst.cpp:395
#163786 0x0062d8b9 in void safe_delete<wxSingleInstanceChecker>(wxSingleInstanceChecker*&) () from /home/keith/desura/build/lin_debug/lib/libuicore.so
#163787 0x0064e8e7 in UICore::~UICore() () from /home/keith/desura/build/lin_debug/lib/libuicore.so
#163788 0x002e31bf in ?? () from /lib/tls/i686/cmov/libc.so.6
#163789 0x002e322f in exit () from /lib/tls/i686/cmov/libc.so.6
#163790 0x002cabde in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#163791 0x0804c981 in _start ()
(gdb) 

Any help would be much appreciated.

Thanks
-Keith 

Vadim Zeitlin

unread,
Jul 29, 2011, 8:38:30 AM7/29/11
to wx-u...@googlegroups.com
On Fri, 29 Jul 2011 16:16:06 +1000 Keith Poole <pla...@gmail.com> wrote:

KP> Before I get into it, quick specs: Ubuntu 10.04.3 LTS i386, GCC 4.5.3,
KP> wxWidgets 2.9.0.

As the first thing, please try updating to 2.9.2, there is really no
reason to stick to (very old by now) 2.9.0.

KP> Suddenly we've had the program terminating abnormally with:
KP>
KP> > *** Caught unhandled unknown exception; terminating

Do you expect your program to throw an exception? If not, set a
breakpoint on throw in gdb to learn where does it come from.

KP> Doing a gdb and backtrace shows the following:
KP>
KP> > [ snip -- repeats all the way to #1 ]
KP> > #163767 0x00d34ecf in wxMBConv::WC2MB (this=0x16844d0, outBuff=0x0,
KP> > inBuff=0x821c010 L"/home/keith/Desura", outLen=0) at
KP> > ./src/common/strconv.cpp:371
...
KP> > #163787 0x0064e8e7 in UICore::~UICore() () from
KP> > /home/keith/desura/build/lin_debug/lib/libuicore.so
KP> > #163788 0x002e31bf in ?? () from /lib/tls/i686/cmov/libc.so.6
KP> > #163789 0x002e322f in exit () from /lib/tls/i686/cmov/libc.so.6
KP> > #163790 0x002cabde in __libc_start_main () from
KP> > /lib/tls/i686/cmov/libc.so.6
KP> > #163791 0x0804c981 in _start ()

It looks like you're using wx functionality from a dtor of a global object
which is being destroyed after wx had been shut down. The simple answer is:
do not do this. A possible fix could be to catch the exception which
results in abnormal program termination and destroy your UICore earlier but
it's really impossible to say more without knowing anything about your
code.

Regards,
VZ

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

Keith Poole

unread,
Jul 29, 2011, 8:43:52 AM7/29/11
to wx-u...@googlegroups.com
Hey Vadim,

Thanks for the prompt response, see my responses below.

-Keitih

On Fri, Jul 29, 2011 at 10:38 PM, Vadim Zeitlin <va...@wxwidgets.org> wrote:
On Fri, 29 Jul 2011 16:16:06 +1000 Keith Poole <pla...@gmail.com> wrote:

KP> Before I get into it, quick specs: Ubuntu 10.04.3 LTS i386, GCC 4.5.3,
KP> wxWidgets 2.9.0.

 As the first thing, please try updating to 2.9.2, there is really no
reason to stick to (very old by now) 2.9.0.

Unfortunately we're suck on 2.9.0 for now, although congrats on the recent release/milestone. We're stuck because we have had to patch some things in 2.9.0 to achieve the functionality that we want for our (extremely) custom interface -- http://www.desura.com . I have suggested to the lead developer that we upgrade though, as I can see a lot of great changes.
No worries, this isn't code that I wrote but I'll have a look at ~UICore().

Cheers

Vadim Zeitlin

unread,
Jul 29, 2011, 10:06:50 AM7/29/11
to wx-u...@googlegroups.com
On Fri, 29 Jul 2011 22:43:52 +1000 Keith Poole <pla...@gmail.com> wrote:

KP> On Fri, Jul 29, 2011 at 10:38 PM, Vadim Zeitlin <va...@wxwidgets.org> wrote:
KP>

KP> > On Fri, 29 Jul 2011 16:16:06 +1000 Keith Poole <pla...@gmail.com> wrote:
KP> >

KP> > KP> Before I get into it, quick specs: Ubuntu 10.04.3 LTS i386, GCC 4.5.3,
KP> > KP> wxWidgets 2.9.0.
KP> >
KP> > As the first thing, please try updating to 2.9.2, there is really no
KP> > reason to stick to (very old by now) 2.9.0.
KP>
KP> Unfortunately we're suck on 2.9.0 for now, although congrats on the recent
KP> release/milestone. We're stuck because we have had to patch some things in
KP> 2.9.0 to achieve the functionality that we want for our (extremely) custom
KP> interface -- http://www.desura.com . I have suggested to the lead developer
KP> that we upgrade though, as I can see a lot of great changes.

You could also consider contributing some of your changes to wxWidgets if
it makes sense. This will take some effort initially but in my experience
will save much more time later as you would be able to upgrade much easier.

Keith Poole

unread,
Jul 30, 2011, 12:05:37 AM7/30/11
to wx-u...@googlegroups.com
Hey Vadim,

That's quite a good idea, I'll have to see which of our changes are relevant though.

Regards,
Keith

Keith Poole

unread,
Jul 31, 2011, 12:00:17 AM7/31/11
to wx-u...@googlegroups.com
By the way, I managed to follow a fair bit of the code back, and it's error in the call to wxEntry(), which has me even more baffled. Something in that code is causing some sort of loop between WC2MB and FromWChar which eventually crashes the call.

-Keith

Vadim Zeitlin

unread,
Jul 31, 2011, 8:17:39 AM7/31/11
to wx-u...@googlegroups.com
On Sun, 31 Jul 2011 14:00:17 +1000 Keith Poole <pla...@gmail.com> wrote:

KP> By the way, I managed to follow a fair bit of the code back, and it's error
KP> in the call to wxEntry(), which has me even more baffled. Something in that
KP> code is causing some sort of loop between WC2MB and FromWChar which
KP> eventually crashes the call.

I think you're using some invalid (already destroyed) global wxMBConv
pointer. I could be wrong but it should be easy to check, just look if the
value of "this" in WC2MB() looks correct.

Keith Poole

unread,
Jul 31, 2011, 8:32:15 AM7/31/11
to wx-u...@googlegroups.com
I'll give it a shot tomorrow,

Cheers.
Reply all
Reply to author
Forward
0 new messages