Skip to content

Commit cab3aa5

Browse files
committed
Set thread index in constructor
1 parent c8222a7 commit cab3aa5

3 files changed

Lines changed: 5 additions & 11 deletions

File tree

gui/checkthread.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ int CheckThread::executeCommand(std::string exe, std::vector<std::string> args,
105105
}
106106

107107

108-
CheckThread::CheckThread(ThreadResult &result) :
109-
mResult(result)
108+
CheckThread::CheckThread(ThreadResult &result, int index)
109+
: mResult(result)
110+
, mThreadIndex(index)
110111
{}
111112

112113
void CheckThread::setSettings(const Settings &settings, std::shared_ptr<Suppressions> supprs)
@@ -498,7 +499,3 @@ QString CheckThread::clangTidyCmd()
498499
return QString();
499500
}
500501

501-
void CheckThread::setThreadIndex(int index)
502-
{
503-
mThreadIndex = index;
504-
}

gui/checkthread.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class CheckThread : public QThread {
5858
};
5959

6060
public:
61-
explicit CheckThread(ThreadResult &result);
61+
CheckThread(ThreadResult &result, int index);
6262

6363
/**
6464
* @brief Set settings for cppcheck
@@ -89,8 +89,6 @@ class CheckThread : public QThread {
8989

9090
void stop();
9191

92-
void setThreadIndex(int index);
93-
9492
/**
9593
* Determine command to run clang
9694
* \return Command to run clang, empty if it is not found

gui/threadhandler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ void ThreadHandler::createThreads(const int count)
146146
removeThreads();
147147
//Create new threads
148148
for (int i = mThreads.size(); i < count; i++) {
149-
mThreads << new CheckThread(mResults);
150-
mThreads.last()->setThreadIndex(i + 1);
149+
mThreads << new CheckThread(mResults, i + 1);
151150
connect(mThreads.last(), &CheckThread::done,
152151
this, &ThreadHandler::threadDone, Qt::QueuedConnection);
153152
connect(mThreads.last(), &CheckThread::finishCheck,

0 commit comments

Comments
 (0)