Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ssu] Read loglevel through QSettings to avoid recursion/crash
  • Loading branch information
Bernd Wachter committed Apr 11, 2014
1 parent b062d35 commit 59e7b81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion libssu/ssucoreconfig.cpp
Expand Up @@ -12,7 +12,6 @@
#include <getdef.h>

#include "ssucoreconfig.h"
#include "ssulog.h"

SsuCoreConfig *SsuCoreConfig::ssuCoreConfig = 0;

Expand Down
8 changes: 5 additions & 3 deletions libssu/ssulog.cpp
Expand Up @@ -27,11 +27,13 @@ void SsuLog::print(int priority, QString message){
QByteArray ba = message.toUtf8();
const char *ca = ba.constData();

// directly go through qsettings here to avoid recursive invocation
// of coreconfig / ssulog
if (ssuLogLevel == -1){
SsuCoreConfig *settings = SsuCoreConfig::instance();
QSettings settings(SSU_CONFIGURATION, QSettings::IniFormat);

if (settings->contains("loglevel"))
ssuLog->ssuLogLevel = settings->value("loglevel").toInt();
if (settings.contains("loglevel"))
ssuLog->ssuLogLevel = settings.value("loglevel").toInt();
else
ssuLog->ssuLogLevel = LOG_ERR;
}
Expand Down

0 comments on commit 59e7b81

Please sign in to comment.