summaryrefslogtreecommitdiff
path: root/Applications/Piano
diff options
context:
space:
mode:
authorAndrew Kaster <andrewdkaster@gmail.com>2020-12-31 00:55:56 -0700
committerAndreas Kling <kling@serenityos.org>2020-12-31 21:59:20 +0100
commit2b3993b008016eef6752024474eb8a45545caf3f (patch)
tree6466ec0156df159c0abeb1c5f15d4c5d5f6a3d24 /Applications/Piano
parentb7fd5315e512a64dac08f53c0b5128da94bf72f0 (diff)
downloadserenity-2b3993b008016eef6752024474eb8a45545caf3f.zip
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.
Diffstat (limited to 'Applications/Piano')
-rw-r--r--Applications/Piano/main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Applications/Piano/main.cpp b/Applications/Piano/main.cpp
index 548bd7eb40..121f1eec0d 100644
--- a/Applications/Piano/main.cpp
+++ b/Applications/Piano/main.cpp
@@ -74,7 +74,7 @@ int main(int argc, char** argv)
Optional<String> save_path;
bool need_to_write_wav = false;
- LibThread::Thread audio_thread([&] {
+ auto audio_thread = LibThread::Thread::construct([&] {
auto audio = Core::File::construct("/dev/audio");
if (!audio->open(Core::IODevice::WriteOnly)) {
dbgln("Can't open audio device: {}", audio->error_string());
@@ -102,7 +102,7 @@ int main(int argc, char** argv)
}
}
});
- audio_thread.start();
+ audio_thread->start();
auto menubar = GUI::MenuBar::construct();