forked from qt-creator/qt-creator
Core: Handle async log category init
If a log category is first used by a different thread than the main thread, we need to make sure that we dispatch the call into the main thread ourselves. Change-Id: I0908366b254649f30a1d18cb4e0da4a7e3988dcc Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -95,6 +95,12 @@ private:
|
|||||||
|
|
||||||
void onFilter(QLoggingCategory *category)
|
void onFilter(QLoggingCategory *category)
|
||||||
{
|
{
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(
|
||||||
|
this, [category, this] { onFilter(category); }, Qt::QueuedConnection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_categories.contains(category)) {
|
if (!m_categories.contains(category)) {
|
||||||
m_categories.append(category);
|
m_categories.append(category);
|
||||||
emit newLogCategory(category);
|
emit newLogCategory(category);
|
||||||
|
|||||||
Reference in New Issue
Block a user