Search code examples
c++crashwxwidgets

wxWidgets Crash on closing application


This is probably a stupid question as this crash is probably related to some invalid pointer or already destroyed object, but looking at the code on all ways I couldn't find out where is the problem.

When I close the software I got a SIGSEVerror with the following message:

#0 00000000 0x003f01c5 in ??() (??:??)
#1 004D36BC wxSocketClient::~wxSocketClient(this=0x2a8bf80, __in_chrg=<value optimized out>) (../../src/common/socket.cpp:1237)
#2 0042E9EE aaa::~aaa(this=0x2a5998c, __in_chrg=<value optimized out>) (C:\Documents and Settings\\My Documents\programming\assistant\Assistant\src\pasan.cpp:71)
#3 00416A49 AssistantFrame::~AssistantFrame(this=0x2a592c8, __in_chrg=<value optimized out>) (C:\Documents and Settings\\My Documents\programming\assistant\Assistant\AssistantMain.cpp:937)
#4 00416FCB AssistantFrame::~AssistantFrame(this=0x2a592c8, __in_chrg=<value optimized out>) (C:\Documents and Settings\\My Documents\programming\assistant\Assistant\AssistantMain.cpp:1007)
#5 00438F21 wxAppBase::DeletePendingObjects(this=0x2a59a58) (../../src/common/appcmn.cpp:423)
#6 00439067 wxAppBase::ProcessIdle(this=0x2a59a58) (../../src/common/appcmn.cpp:454)
#7 004DD68B wxEventLoopManual::Run(this=0x2ac4fb0) (../../src/common/evtloopcmn.cpp:99)
#8 00438C62 wxAppBase::MainLoop(this=0x2a59a58) (../../src/common/appcmn.cpp:312)
#9 00438D95 wxAppBase::OnRun(this=0x2a59a58) (../../src/common/appcmn.cpp:367)
#10 004E8372    wxEntryReal(argc=@0x22fe5c, argv=0x3f2880) (../../src/common/init.cpp:448)
#11 004330C0    wxEntry(argc=@0x22fe5c, argv=0x3f2880) (../../src/msw/main.cpp:231)
#12 004332AF    wxEntry(hInstance=0x400000, nCmdShow=10) (../../src/msw/main.cpp:386)
#13 00401441    WinMain(hInstance=0x400000, hPrevInstance=0x0, lpCmdLine=0x251f49 "", nCmdShow=10) (C:\Documents and Settings\\My Documents\programming\assistant\Assistant\AssistantApp.cpp:17)
#14 00000000    0x005f9566 in main() (??:??)

The problem is my code is already about 5k lines and using many controls. Is from this some helping information as I'm not a debugger specialist ?

Thanks for your help


Solution

  • In general:

    • Do a debug build

    • Run the application

    • You may well get extra windows popping up with extra information about dodgy code. If so, track down the problems that the debug build has noticed and fix them

    • Does this fix the problem?

    • If not, run the app under the debugger. When the crash occurs, look at the call stack. Work your way up from the bottom until you enter code you recognize. This will tell you what code was executing when the crash occurred. It may be in a destructor for one of your classes, which will give you a strong clue as to what needs to be fixed.

    In this particular case:

    It seems the crash occurs in the destructor of wxSocketClient, called from ../../src/common/socket.cpp:1237 Have you looked at this? Are you doing here a double delete of an instance of wxSocketClient?