wxWidgets 关闭应用程序时崩溃
这可能是一个愚蠢的问题,因为这次崩溃可能与某些无效的指针或已经被破坏的对象有关,但是从各种方式查看代码我无法找出问题所在。
当我关闭软件时,我收到 SIGSEV 错误,并显示以下消息:
#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() (??:??)
问题是我的代码已经有大约 5k 行并使用了许多控件。 因为我不是调试器专家,所以这里有一些帮助信息吗?
感谢您的帮助
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
找到调试起点的解决方案是实际查看该转储。第三行指出
现在,要开始调试,请查看
My Documents\programming\assistant\Assistant\src\pasan.cpp
,第 71 行。The solution to finding a beginning spot for your debugging is to actually look at that dump. The third lines states
Now, to start with your debugging, look at
My Documents\programming\assistant\Assistant\src\pasan.cpp
, line 71.一般来说:
进行调试构建
运行应用程序
您可能会弹出额外的窗口,其中包含有关可疑代码的额外信息。如果是这样,请跟踪调试版本发现的问题并修复它们
这可以解决问题吗?
如果没有,请在调试器下运行应用程序。当崩溃发生时,查看调用堆栈。从底部开始,直到输入您认识的代码。这将告诉您崩溃发生时正在执行哪些代码。它可能位于您的某个类的析构函数中,这将为您提供有关需要修复哪些内容的强有力线索。
在这种特殊情况下:
崩溃似乎发生在 wxSocketClient 的析构函数中,从 ../../src/common/socket.cpp:1237 调用您看过这个吗?您在这里对 wxSocketClient 实例进行双重删除吗?
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?
我认为在不查看源代码的情况下很难给出答案。您可以通过暂时禁用/注释掉/不实例化某些类/窗口来降低代码的复杂性吗?从 wxApp 开始,仅调用一个简单的 wxFrame 并检查它是否正常工作,没有任何问题......然后继续逐步重新启用您的类。
乌多
I think it's hard to give an answer here without looking into the source code. Could you reduce the complexity of your code by temporarily disable/comment out/ not instanciating some classes/windows? How about starting from wxApp only calling a simple wxFrame and check if this is working without any problems...then go on step by step reenabling your classes.
Udo