mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-09 09:12:50 +02:00
Merge pull request #26 from birarda/entity-script-server
fix LogHandler attempting to create children on wrong thread
This commit is contained in:
commit
6046573394
2 changed files with 9 additions and 1 deletions
|
@ -186,7 +186,7 @@ void LogHandler::verboseMessageHandler(QtMsgType type, const QMessageLogContext&
|
|||
getInstance().printMessage((LogMsgType) type, context, message);
|
||||
}
|
||||
|
||||
const QString& LogHandler::addRepeatedMessageRegex(const QString& regexString) {
|
||||
void LogHandler::setupRepeatedMessageFlusher() {
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [&] {
|
||||
// setup our timer to flush the verbose logs every 5 seconds
|
||||
|
@ -194,6 +194,11 @@ const QString& LogHandler::addRepeatedMessageRegex(const QString& regexString) {
|
|||
connect(logFlushTimer, &QTimer::timeout, this, &LogHandler::flushRepeatedMessages);
|
||||
logFlushTimer->start(VERBOSE_LOG_INTERVAL_SECONDS * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
const QString& LogHandler::addRepeatedMessageRegex(const QString& regexString) {
|
||||
// make sure we setup the repeated message flusher, but do it on the LogHandler thread
|
||||
QMetaObject::invokeMethod(this, "setupRepeatedMessageFlusher");
|
||||
|
||||
QMutexLocker lock(&_mutex);
|
||||
return *_repeatedMessageRegexes.insert(regexString);
|
||||
|
|
|
@ -53,6 +53,9 @@ public:
|
|||
const QString& addRepeatedMessageRegex(const QString& regexString);
|
||||
const QString& addOnlyOnceMessageRegex(const QString& regexString);
|
||||
|
||||
private slots:
|
||||
void setupRepeatedMessageFlusher();
|
||||
|
||||
private:
|
||||
LogHandler();
|
||||
~LogHandler();
|
||||
|
|
Loading…
Reference in a new issue