Hi, ALL,
First about my environment(s):
wxWidgets 3.1.1
- Windows: MSVC 2017 Community Edition with default debug build (no setup changes) Windows version is 8.1
- *nix: Anjuta with gcc-5.4 built against GTK+3 (self-compiled)
- OSX: 10.8 with XCode/clang (c++11), again default debug build.
What's strange is that my program crashes on Windows when I click the "X" button of the main frame (on exit).
This does not happen on both *nix and Mac.
The crash happens somewhere inside wxWidgets, but I can't see where because of this.
So basically the backtrace window of MSVC shows many frames with the wxmsw311ud_core on top, but the editor window shows the end of the main frame constructor.
It would be very nice to fix the crash on Windows, but I don't even know where to start, since I don't know where the crash is.
Could someone please help? Even if you suggest on how to fix the debugging symbols...
Thank you.
Weird crash on MSW
Re: Weird crash on MSW
Try write MCVE and maybe it'll became obvious. I don't think it's possible to say something without code.
Re: Weird crash on MSW
Hi,
Thank you for the reply.
Did you look at my SO post? Any idea why MSVC does not see the pdb files from wx?
Thank you.
Thank you for the reply.
Did you look at my SO post? Any idea why MSVC does not see the pdb files from wx?
Thank you.
Re: Weird crash on MSW
What happens if you (at least temporarily) switch to static linking? Does it crash, too? If yes, you should get a proper call stack.
And the obvious question: Does it happen in any of the samples?
Do you have a close event handler? If yes, can you show it?
And the obvious question: Does it happen in any of the samples?
Do you have a close event handler? If yes, can you show it?
Use the source, Luke!
Re: Weird crash on MSW
Doublemax,
Its going to be multiple copies of wx from all those DLLs.
Is it OK?
Nothing fancy. And of course this:
Thank you.
I can try, but since the program have multiple DLLs and have a secondary thread I don't think it is a good idea.
Its going to be multiple copies of wx from all those DLLs.
Is it OK?
And the obvious answer - no. Neither in DLL, nor in thread one.
Here it is:
Code: Select all
void MainFrame::OnClose(wxCloseEvent &WXUNUSED(event))
{
if( m_db )
{
#if defined _DEBUG
printf( "Starting MainFrame::OnClose\n\r" );
#endif
{
std::lock_guard<std::mutex>( m_db->GetTableVector().my_mutex );
if( m_handler )
{
#if defined _DEBUG
printf( "Deleting the thread...\n\r" );
#endif
if( m_handler->Delete() != wxTHREAD_NO_ERROR )
{
}
}
}
while( 1 )
{
#if defined _DEBUG
printf( "Looping for thread deletionn\n\r" );
#endif
{
std::lock_guard<std::mutex>( m_db->GetTableVector().my_mutex );
if( !m_handler )
break;
}
wxThread::This()->Sleep( 1 );
}
#if defined _DEBUG
printf( "Thread destroyed. Deleting application....\n\r" );
#endif
}
Destroy();
}
Code: Select all
MainFrame::~MainFrame()
{
std::vector<std::wstring> errorMsg;
int result = 0;
wxConfigBase *config = wxConfigBase::Get( "DBManager" );
wxString path = config->GetPath();
config->SetPath( "CurrentDB" );
if( m_db )
{
wxString temp1( m_db->GetTableVector().m_type );
config->Write( "Engine", temp1 );
wxString temp2 = m_db->GetTableVector().m_subtype;
config->Write( "Subtype", temp2 );
if( temp2 == "PostgreSQL" )
{
wxString temp3( m_db->GetTableVector().GetPostgreLogFile() );
config->Write( "Logfile", temp3 );
}
std::lock_guard<std::mutex>( m_db->GetTableVector().my_mutex );
result = m_db->Disconnect( errorMsg );
}
if( result )
{
for( std::vector<std::wstring>::iterator it = errorMsg.begin(); it < errorMsg.end(); it++ )
{
wxMessageBox( (*it) );
}
}
delete m_db;
m_db = NULL;
for( std::map<wxString, wxDynamicLibrary *>::iterator it = m_painters.begin(); it != m_painters.end(); ++it )
{
delete (*it).second;
(*it).second = NULL;
}
}
Re: Weird crash on MSW
I don't see any obvious error. What about the printf() calls, do you see their output? With them you should be able to narrow down where it crashes. If you don't see them, use wxLogDebug instead.
Use the source, Luke!