@@ -142,7 +142,7 @@ void CWebCore::AddEventToEventQueue ( std::function<void(void)> event, CWebView*
142
142
#ifndef MTA_DEBUG
143
143
UNREFERENCED_PARAMETER (name);
144
144
#endif
145
- if ( pWebView->IsBeingDestroyed () )
145
+ if ( pWebView && pWebView ->IsBeingDestroyed () )
146
146
return ;
147
147
148
148
std::lock_guard<std::mutex> lock ( m_EventQueueMutex );
@@ -206,12 +206,12 @@ eURLState CWebCore::GetURLState ( const SString& strURL, bool bOutputDebug )
206
206
return eURLState::WEBPAGE_ALLOWED;
207
207
else
208
208
{
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 );
210
210
return eURLState::WEBPAGE_DISALLOWED;
211
211
}
212
212
}
213
213
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 );
215
215
return eURLState::WEBPAGE_NOT_LISTED;
216
216
}
217
217
@@ -372,6 +372,13 @@ bool CWebCore::IsRequestsGUIVisible ()
372
372
return m_pRequestsGUI && m_pRequestsGUI->IsVisible ();
373
373
}
374
374
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
+
375
382
bool CWebCore::GetRemotePagesEnabled ()
376
383
{
377
384
bool bCanLoadRemotePages;
0 commit comments