Hi,
I am writing an application with the main thread handling the GUI and
multiple threads each reading files and writing to a SQLite database.
in Debug mode all threads write to the debugging facility, a log file
set using wxLog::SetActiveTarget) and a wxLogWindow Window to intercept
and display messages on the screen.
Everything is working fine except that from time to time the app
crashes unexpectedly. I captured the call stack and it
seems to point towards a issue with logging to the wxTextCtrl of the
wxLogWindow:
#0 000E5172 ??() (??:??)
#1 66EC7EAB wxTextCtrl::GetLastPosition(this=0xe41588)
(../../src/msw/textctrl.cpp:1329)
#2 66F8E08A wxLogWindow::DoLogString(this=0xe40c78,
szString=0xee6cb4) (../../src/generic/logg.cpp:654)
#3 66D9562E wxLog::DoLog(this=0xe40c78, level=3, szString=0xee6cb4,
t=1203852231) (../../src/common/log.cpp:476)
#4 66F8E015 wxLogWindow::DoLog(this=0xe40c78, level=3,
szString=0xee6cb4, t=1203852231) (../../src/generic/logg.cpp:642)
#5 66D95000 wxLog::OnLog(level=3, szString=0xee6cb4, t=1203852231)
(../../src/common/log.cpp:350)
#6 66D93F33 wxVLogMessage(szFormat=0x42725c, argptr=0x150fc2c ",
Æ\001") (../../src/common/log.cpp:121)
#7 66D93FA4 wxLogMessage(szFormat=0x42725c)
(../../src/common/log.cpp:121)
#8 004094E6 jcFeedProcessor::Read(this=0x150fe18, XmlUrl=@0x150fe18)
(C:/dev/funnel/feed/feed.cpp:116)
#9 00408F28 jcFeedProcessor::Read(this=0x150fe18)
(C:/dev/funnel/feed/feed.cpp:48)
#10 00406BC3 jcDatabase::LoadFeed(this=0x2155420, XmlUrl=@0x1c5beec)
(C:/dev/funnel/database.cpp:569)
#11 004128A2 jcFeedThread::Entry(this=0x1c5bec0)
(C:/dev/funnel/thread.cpp:36)
#12 66DF0E68 wxThreadInternal::DoThreadStart(thread=0x1c5bec0)
(../../src/msw/thread.cpp:530)
#13 66DF0F82 wxThreadInternal::WinThreadStart(param=0x1c5bec0)
(../../src/msw/thread.cpp:557)
#14 77C3A3B0 msvcrt!_endthreadex()
(C:\WINDOWS\system32\msvcrt.dll:??)
#15 01C5BEC0 ??() (??:??)
#16 00000000 ??() (??:??)
wxMSW-2.8.7 unicode MinGW with gcc-3.4.5
My questions are: in a multi-threaded environment do wxLogDebug calls
need to be protected by a Mutex? Would logging to file only (i.e. no
log window) resolve the issue?
Thanks,
~jc