From 2b3993b008016eef6752024474eb8a45545caf3f Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Thu, 31 Dec 2020 00:55:56 -0700 Subject: LibThread: Hide Thread's constructor, as it is a Core::Object Just constructing one of these guys on the stack willy nilly will leak the first reference to them. There might be other C_OBJECTs that have public constructors, seems like a good place for some static analysis checks :). Force users to call the construct() method for it. --- Libraries/LibThread/Thread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Libraries/LibThread') diff --git a/Libraries/LibThread/Thread.h b/Libraries/LibThread/Thread.h index 26ef07d35d..28fba0d78a 100644 --- a/Libraries/LibThread/Thread.h +++ b/Libraries/LibThread/Thread.h @@ -37,7 +37,6 @@ class Thread final : public Core::Object { C_OBJECT(Thread); public: - explicit Thread(Function action, StringView thread_name = nullptr); virtual ~Thread(); void start(); @@ -46,6 +45,7 @@ public: pthread_t tid() const { return m_tid; } private: + explicit Thread(Function action, StringView thread_name = nullptr); Function m_action; pthread_t m_tid { 0 }; String m_thread_name; -- cgit v1.2.3