【问题标题】:wxWidgets Crash on closing applicationwxWidgets 在关闭应用程序时崩溃
【发布时间】:2011-09-02 08:33:05
【问题描述】:

这可能是一个愚蠢的问题,因为此崩溃可能与某些无效指针或已销毁的对象有关,但是从各种方式查看代码我无法找出问题所在。

当我关闭软件时,我收到一个 SIGSEVerror 并显示以下消息:

#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 行并且使用了许多控件。 由于我不是调试器专家,因此是否提供了一些帮助信息?

感谢您的帮助

【问题讨论】:

    标签: c++ crash wxwidgets


    【解决方案1】:

    一般:

    • 进行调试构建

    • 运行应用程序

    • 您很可能会弹出额外的窗口,其中包含有关狡猾代码的额外信息。如果是这样,请追踪调试版本注意到的问题并修复它们

    • 这能解决问题吗?

    • 如果没有,请在调试器下运行应用程序。当崩溃发生时,查看调用堆栈。从底部向上工作,直到输入您识别的代码。这将告诉您崩溃发生时正在执行的代码。它可能位于您的某个类的析构函数中,这将为您提供关于需要修复的内容的有力线索。

    在这种特殊情况下:

    似乎崩溃发生在 wxSocketClient 的析构函数中,从 ../../src/common/socket.cpp:1237 调用你看过这个吗?你是在这里对 wxSocketClient 的一个实例进行双重删除吗?

    【讨论】:

    • 感谢您的提示,我做了调试版本并运行到调试器,但它没有帮助我。我将深入了解 wxSocketClient
    【解决方案2】:

    我认为如果不查看源代码就很难在这里给出答案。您能否通过暂时禁用/注释掉/不实例化某些类/窗口来降低代码的复杂性?如何从 wxApp 开始只调用一个简单的 wxFrame 并检查它是否正常工作......然后继续逐步重新启用您的类。

    乌多

    【讨论】:

      【解决方案3】:

      找到调试起点的解决方案是实际查看该转储。第三行说明

      #2 0042E9EE aaa::~aaa(this=0x2a5998c, __in_chrg=<value optimized out>) \
       (C:\Documents and Settings\My Documents\programming\assistant\Assistant\src\pasan.cpp:71)
      

      现在,开始调试,查看My Documents\programming\assistant\Assistant\src\pasan.cpp,第 71 行。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-09-13
        • 2012-11-06
        • 1970-01-01
        • 1970-01-01
        • 2017-07-27
        • 1970-01-01
        • 1970-01-01
        • 2013-01-02
        相关资源
        最近更新 更多