chore: mini refactorings and dead code removal (#5512)

This commit is contained in:
nerix
2024-07-20 11:35:59 +02:00
committed by GitHub
parent deb4401036
commit b3c09b65d8
28 changed files with 65 additions and 506 deletions
-24
View File
@@ -3,33 +3,9 @@
#include "debug/AssertInGuiThread.hpp"
#include <QCoreApplication>
#include <QRunnable>
#include <QThreadPool>
#include <functional>
#define async_exec(a) \
QThreadPool::globalInstance()->start(new LambdaRunnable(a));
namespace chatterino {
class LambdaRunnable : public QRunnable
{
public:
LambdaRunnable(std::function<void()> action)
: action_(std::move(action))
{
}
void run() override
{
this->action_();
}
private:
std::function<void()> action_;
};
// Taken from
// https://stackoverflow.com/questions/21646467/how-to-execute-a-functor-or-a-lambda-in-a-given-thread-in-qt-gcd-style
// Qt 5/4 - preferred, has least allocations