Skip to content

Commit 004ef8b

Browse files
committed
Fixed redundant lmTrace initializations.
1 parent 998e773 commit 004ef8b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

sources/lmcore.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,9 @@ void lmCore::settingsChanged(void) {
196196

197197
if(!Helper::stringToBool(pInitParams->data(XN_TRACEMODE))){ //No /trace argument from console
198198
if(pSettings->value(IDS_DEBUGLOG, IDS_DEBUGLOG_VAL).toBool()){ //Debuglog setting from UI
199-
lmTrace::init(pInitParams->data(XN_LOGFILE) , true);
200-
lmTrace::write("Debug logging started via settingsChanged");
199+
if (!lmTrace::check()){
200+
lmTrace::init(pInitParams->data(XN_LOGFILE) , true);
201+
lmTrace::write("Debug logging started via settingsChanged");}
201202
}else {
202203
lmTrace::stop("Debug logging stopped via settingsChanged");
203204
}

sources/trace.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ void lmTrace::stop(const QString& string) {
7272
write("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
7373
lmTrace::traceMode = false;
7474
}
75+
76+
bool lmTrace::check(){
77+
return lmTrace::traceMode;
78+
}

sources/trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class lmTrace {
3535
static void init(QString fileName, bool traceMode);
3636
static void write(const QString& string, bool verbose = true);
3737
static void stop(const QString& string);
38+
static bool check();
3839

3940
private:
4041
static bool traceMode;

0 commit comments

Comments
 (0)