@@ -142,7 +142,7 @@ void CWebCore::AddEventToEventQueue ( std::function<void(void)> event, CWebView*
142142#ifndef MTA_DEBUG
143143 UNREFERENCED_PARAMETER (name);
144144#endif
145- if ( pWebView->IsBeingDestroyed () )
145+ if ( pWebView && pWebView ->IsBeingDestroyed () )
146146 return ;
147147
148148 std::lock_guard<std::mutex> lock ( m_EventQueueMutex );
@@ -206,12 +206,12 @@ eURLState CWebCore::GetURLState ( const SString& strURL, bool bOutputDebug )
206206 return eURLState::WEBPAGE_ALLOWED;
207207 else
208208 {
209- if ( m_bTestmodeEnabled && bOutputDebug ) g_pCore-> DebugPrintfColor ( " [BROWSER] Blocked page: %s" , 255 , 0 , 0 , strURL. c_str () );
209+ if ( m_bTestmodeEnabled && bOutputDebug ) DebugOutputThreadsafe ( SString ( " [BROWSER] Blocked page: %s" , strURL. c_str () ), 255 , 0 , 0 );
210210 return eURLState::WEBPAGE_DISALLOWED;
211211 }
212212 }
213213
214- if ( m_bTestmodeEnabled && bOutputDebug ) g_pCore-> DebugPrintfColor ( " [BROWSER] Blocked page: %s" , 255 , 0 , 0 , strURL. c_str () );
214+ if ( m_bTestmodeEnabled && bOutputDebug ) DebugOutputThreadsafe ( SString ( " [BROWSER] Blocked page: %s" , strURL. c_str () ), 255 , 0 , 0 );
215215 return eURLState::WEBPAGE_NOT_LISTED;
216216}
217217
@@ -372,6 +372,13 @@ bool CWebCore::IsRequestsGUIVisible ()
372372 return m_pRequestsGUI && m_pRequestsGUI->IsVisible ();
373373}
374374
375+ void CWebCore::DebugOutputThreadsafe ( const SString& message, unsigned char R, unsigned char G, unsigned char B )
376+ {
377+ AddEventToEventQueue ( [message, R, G, B]() {
378+ g_pCore->DebugEchoColor ( message, R, G, B );
379+ }, nullptr , " DebugOutputThreadsafe" );
380+ }
381+
375382bool CWebCore::GetRemotePagesEnabled ()
376383{
377384 bool bCanLoadRemotePages;
0 commit comments