Hi all,

found the reason the MusicBrowserUI code crashes at random spots when you
open the
MusicBrowser, press the NewPlaylist button, then close the new window that
just got
opened.. :-}

at the end of MusicBrowserUI::CreateMainDialog(), when the message pump is
all
done and it's time for the window to go away.. the end of the function goes
like:
(this code is in Dialog.cpp)

    DestroyWindow(m_hWnd);
    m_hWnd = NULL;

the DestroyWindow() call causes the system to send WM_DESTROY to the
window's message queue, which calls the window's Destroy() member function,
which, if it has a parent, tells its parent to remove this window, and then
*deletes this object*.

so, we've deallocated our memory, then we return to that m_hWnd = NULL.. :-)
which corrupts our heap and likely overwrites & corrupts something in
another
thread that just grabbed that memory.

-Jason

p.s. dialog_cpp.diff (attached) fixes this problem.

-Jason


dialog_cpp.diff

Reply via email to