+void wxLogFrame::OnInternalIdle()
+{
+ {
+ wxCRIT_SECT_LOCKER(locker, m_critSection);
+
+ const size_t count = m_pendingMessages.size();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ DoShowLogMessage(m_pendingMessages[n]);
+ }
+
+ m_pendingMessages.clear();
+ } // release m_critSection
+
+ wxFrame::OnInternalIdle();
+}
+
+void wxLogFrame::AddLogMessage(const wxString& message)
+{
+ wxCRIT_SECT_LOCKER(locker, m_critSection);
+
+#if wxUSE_THREADS
+ if ( !wxThread::IsMain() || !m_pendingMessages.empty() )
+ {
+ // message needs to be queued for later showing
+ m_pendingMessages.Add(message);
+
+ wxWakeUpIdle();
+ }
+ else // we are the main thread and no messages are queued, so we can
+ // log the message directly
+#endif // wxUSE_THREADS
+ {
+ DoShowLogMessage(message);
+ }
+}
+