openMSX / wxcatapult

23 stars 4 forks source link

[Bug] Fix end-of-life of m_connectThread properly [sf#497] #30

Open openMSX-import opened 9 years ago

openMSX-import commented 9 years ago

Reported by joxy on 2013-08-17 19:04 UTC

commit ada1033e487c51b6cb1f9da58aaebb850a135efe
Author: wouter
Date:   Sat Aug 17 10:52:16 2013 +0200

    Hack: don't delete m_connectThread

    Vampier reported a crash on exit. This was in windows-specific code while
    destroying the m_connectThread object. I recently added this because before it
    was leaked. Though a leak is better than a crash, so I restored the old
    behavior. It's not a big leak: only a few kB (or less?) each time openMSX is
    stopped. Someone with a deeper understanding of wxWidgets could look into
    this, but for me this is low priority.

diff --git a/src/openMSXController.cpp b/src/openMSXController.cpp
--- a/src/openMSXController.cpp
+++ b/src/openMSXController.cpp
@@ -104,7 +104,8 @@ void openMSXController::HandleEndProcess(wxCommandEvent& event)

 #ifdef __WXMSW__
    if (!m_pipeActive) {
-       m_connectThread.reset();
+       // m_connectThread.reset(); // TODO why does this crash?
+       m_connectThread.release();  // this is a memory leak
    }
 #else
    close(m_openMSXstdin);

EGP writes: I kinda love both low-level debugging and also love debugging and fixing thread issues, so I'll open a ticket for me WRT this issue.

openMSX-import commented 9 years ago

Commented by joxy on 2013-08-17 19:05 UTC Related ticket : http://sourceforge.net/p/openmsx/bugs/496/