Uploaded image for project: 'GMAT'
  1. GMAT
  2. GMT-4294

Segmentation Fault when closing with open OrbitView on Linux

    Details

      Description

      Running on Linux, GMAT consistently crashes with a segmentation fault on exit if the user leaves an OrbitView window open. To see this, run GMAT on Linux from a terminal window. Run the Hohmann transfer sample script. Close GMAT using the close button on the window frame. GMAT will close, but in the close process, it looks like it is trying to delete an already deleted handle. Here is the backtrace:

      Program received signal SIGSEGV, Segmentation fault.
      0x00007ffff2570f18 in main_arena () from /lib/x86_64-linux-gnu/libc.so.6
      (gdb) bt
      #0  0x00007ffff2570f18 in main_arena () from /lib/x86_64-linux-gnu/libc.so.6
      #1  0x000000000061da49 in GmatMdiChildFrame::UpdateGuiItem (this=0x1926800, updateEdit=0, updateAnimation=0)
          at foundation/GmatMdiChildFrame.cpp:780
      #2  0x000000000061be7f in GmatMdiChildFrame::~GmatMdiChildFrame (this=0x1926800, __in_chrg=<optimized out>)
          at foundation/GmatMdiChildFrame.cpp:179
      #3  0x000000000089e404 in MdiChildViewFrame::~MdiChildViewFrame (this=0x1926800, __in_chrg=<optimized out>)
          at subscriber/MdiChildViewFrame.cpp:78
      #4  0x00000000008a5588 in MdiChild3DViewFrame::~MdiChild3DViewFrame (this=0x1926800, __in_chrg=<optimized out>)
          at subscriber/MdiChild3DViewFrame.cpp:60
      #5  0x00000000008a55b8 in MdiChild3DViewFrame::~MdiChild3DViewFrame (this=0x1926800, __in_chrg=<optimized out>)
          at subscriber/MdiChild3DViewFrame.cpp:62
      #6  0x00007ffff3741f36 in wxWindowBase::DestroyChildren() () from ./lib/libwx_gtk2_core-2.8.so.0
      #7  0x00007ffff367e7a2 in wxWindow::~wxWindow() () from ./lib/libwx_gtk2_core-2.8.so.0
      #8  0x00007ffff36bd0d9 in wxMDIClientWindow::~wxMDIClientWindow() () from ./lib/libwx_gtk2_core-2.8.so.0
      #9  0x00007ffff3741f36 in wxWindowBase::DestroyChildren() () from ./lib/libwx_gtk2_core-2.8.so.0
      #10 0x00007ffff367e7a2 in wxWindow::~wxWindow() () from ./lib/libwx_gtk2_core-2.8.so.0
      #11 0x000000000047fc88 in GmatMainFrame::~GmatMainFrame (this=0x1779050, __in_chrg=<optimized out>) at app/GmatMainFrame.cpp:561
      #12 0x000000000047fd18 in GmatMainFrame::~GmatMainFrame (this=0x1779050, __in_chrg=<optimized out>) at app/GmatMainFrame.cpp:623
      #13 0x00007ffff36d8a82 in wxAppBase::DeletePendingObjects() () from ./lib/libwx_gtk2_core-2.8.so.0
      #14 0x00007ffff36d8c2b in wxAppBase::ProcessIdle() () from ./lib/libwx_gtk2_core-2.8.so.0
      #15 0x00007ffff36568ee in wxapp_idle_callback () from ./lib/libwx_gtk2_core-2.8.so.0
      #16 0x00007ffff11973b6 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #17 0x00007ffff1197708 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #18 0x00007ffff1197b0a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #19 0x00007ffff1c9e277 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
      #20 0x00007ffff366a818 in wxEventLoop::Run() () from ./lib/libwx_gtk2_core-2.8.so.0
      #21 0x00007ffff36d899c in wxAppBase::MainLoop() () from ./lib/libwx_gtk2_core-2.8.so.0
      #22 0x00007ffff33db5d5 in wxEntry(int&, char**) () from ./lib/libwx_base-2.8.so.0
      #23 0x0000000000455944 in main (argc=1, argv=0x7fffffffdf58) at app/GmatApp.cpp:59
      (gdb) 
      

      The crash is seen on Linux. It might have implications for other platforms, or it could be a "feature" of wxGTK.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              djcinsb Darrel Conway created issue -
              rqureshi Rizwan Qureshi made changes -
              Field Original Value New Value
              Labels CCB
              Hide
              rqureshi Rizwan Qureshi added a comment -

              CCB: I have labeled this ticket as CCB so that CCB can triage this ticket. Please note: I did not change Assignee.

              Show
              rqureshi Rizwan Qureshi added a comment - CCB: I have labeled this ticket as CCB so that CCB can triage this ticket. Please note: I did not change Assignee.
              Hide
              djcinsb Darrel Conway added a comment -

              I thought CCB saw all new bugs, regardless of the "CCB" tag. (It should be assigned to me once it has been reviewed.)

              Show
              djcinsb Darrel Conway added a comment - I thought CCB saw all new bugs, regardless of the "CCB" tag. (It should be assigned to me once it has been reviewed.)
              Hide
              rqureshi Rizwan Qureshi added a comment -

              Oh that is right. The bugs are automatically seen by CCB and only improvements etc need to be specifically tagged as "CCB" in order for CCB to see them! Thanks for this correction!

              Show
              rqureshi Rizwan Qureshi added a comment - Oh that is right. The bugs are automatically seen by CCB and only improvements etc need to be specifically tagged as "CCB" in order for CCB to see them! Thanks for this correction!
              shughes Steven Hughes made changes -
              Labels CCB
              shughes Steven Hughes made changes -
              Fix Version/s R2013c [ 10500 ]
              shughes Steven Hughes made changes -
              Priority P1 [ 1 ] P2 [ 3 ]
              shughes Steven Hughes made changes -
              Assignee Rizwan Qureshi [ rqureshi ] Darrel Conway [ djcinsb ]
              shughes Steven Hughes made changes -
              Priority P2 [ 3 ] P1 [ 1 ]
              Hide
              shughes Steven Hughes added a comment -

              CCB: Spend a few hours to see if this can be fixed then make P2 if no luck.

              Show
              shughes Steven Hughes added a comment - CCB: Spend a few hours to see if this can be fixed then make P2 if no luck.
              shughes Steven Hughes made changes -
              Fix Version/s R2013c [ 10500 ]
              Fix Version/s R2014b [ 10600 ]
              shughes Steven Hughes made changes -
              Affects Version/s R2013c [ 10500 ]
              djcinsb Darrel Conway made changes -
              Remaining Estimate 2 days [ 57600 ]
              Original Estimate 2 days [ 57600 ]
              djcinsb Darrel Conway made changes -
              Link This issue relates to GMT-4334 [ GMT-4334 ]
              shughes Steven Hughes made changes -
              Priority P1 [ 1 ] P2 [ 3 ]
              shughes Steven Hughes made changes -
              Affects Version/s R2015a [ 10600 ]
              shughes Steven Hughes made changes -
              Fix Version/s R2015a [ 10600 ]
              Fix Version/s NearTermBackLog [ 11103 ]
              shughes Steven Hughes made changes -
              Affects Version/s R2016a [ 10800 ]
              bet Bryan Topp made changes -
              Attachment mdiclose.diff [ 16782 ]
              Hide
              bet Bryan Topp added a comment -

              mdiclose.diff

              I've attached a patch which I believe fixes this issue.

              When a GmatMdiChildFrame is closed (specifically, deleted), it tries to use UpdateGuiItem to alter some widgets in its parent. If the parent is in the process of being destroyed - as when closing the whole program - then this fails. I checked out the wxWidgets references and I believe the cleanup is generally happening correctly; the parent MDI frame (in this case, the MainFrame) is cleaning up its children as part of its own cleanup. At the time the MdiChildFrame's destructor is called, though, trying to alter the toolbar (for example) in the main frame causes a crash on some platforms.

              My patch checks the MainFrame pointer in the GmatAppData - which is zeroed in the destructor of GmatMainFrame - to determine if the main frame is being destroyed and, if so, does not call UpdateGuiItem.

              Show
              bet Bryan Topp added a comment - mdiclose.diff I've attached a patch which I believe fixes this issue. When a GmatMdiChildFrame is closed (specifically, deleted), it tries to use UpdateGuiItem to alter some widgets in its parent. If the parent is in the process of being destroyed - as when closing the whole program - then this fails. I checked out the wxWidgets references and I believe the cleanup is generally happening correctly; the parent MDI frame (in this case, the MainFrame) is cleaning up its children as part of its own cleanup. At the time the MdiChildFrame's destructor is called, though, trying to alter the toolbar (for example) in the main frame causes a crash on some platforms. My patch checks the MainFrame pointer in the GmatAppData - which is zeroed in the destructor of GmatMainFrame - to determine if the main frame is being destroyed and, if so, does not call UpdateGuiItem.
              shughes Steven Hughes made changes -
              Affects Version/s R2017a [ 11000 ]
              shughes Steven Hughes made changes -
              Affects Version/s R2018A [ 11104 ]

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:

                    Time Tracking

                    Estimated:
                    Original Estimate - 2 days
                    2d
                    Remaining:
                    Remaining Estimate - 2 days
                    2d
                    Logged:
                    Time Spent - Not Specified
                    Not Specified