mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
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.
This commit is contained in:
parent
b7fd5315e5
commit
2b3993b008
5 changed files with 8 additions and 8 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue