mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 15:07:45 +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
|
@ -35,12 +35,12 @@ namespace AudioServer {
|
|||
|
||||
Mixer::Mixer()
|
||||
: m_device(Core::File::construct("/dev/audio", this))
|
||||
, m_sound_thread(
|
||||
, m_sound_thread(LibThread::Thread::construct(
|
||||
[this] {
|
||||
mix();
|
||||
return 0;
|
||||
},
|
||||
"AudioServer[mixer]")
|
||||
"AudioServer[mixer]"))
|
||||
{
|
||||
if (!m_device->open(Core::IODevice::WriteOnly)) {
|
||||
dbgprintf("Can't open audio device: %s\n", m_device->error_string());
|
||||
|
@ -52,7 +52,7 @@ Mixer::Mixer()
|
|||
|
||||
m_zero_filled_buffer = (u8*)malloc(4096);
|
||||
bzero(m_zero_filled_buffer, 4096);
|
||||
m_sound_thread.start();
|
||||
m_sound_thread->start();
|
||||
}
|
||||
|
||||
Mixer::~Mixer()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue