1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

AudioServer: Fix visibility of Object-derivative constructors

Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.

This commit is separate from the other Servives changes because it
required additional adaption of the code. Note that the old code did
precisely what these changes try to prevent: Create and handle a
ref-counted object with a refcount of zero.
This commit is contained in:
Ben Wiederhake 2021-10-31 23:38:04 +01:00 committed by Andreas Kling
parent 4e55d649d7
commit 25032a02aa
3 changed files with 6 additions and 4 deletions

View file

@ -23,7 +23,6 @@ class Mixer;
class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint> {
C_OBJECT(ClientConnection)
public:
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id, Mixer& mixer);
~ClientConnection() override;
void did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id);
@ -36,6 +35,8 @@ public:
static void for_each(Function<void(ClientConnection&)>);
private:
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id, Mixer& mixer);
virtual Messages::AudioServer::GetMainMixVolumeResponse get_main_mix_volume() override;
virtual void set_main_mix_volume(double) override;
virtual Messages::AudioServer::GetSelfVolumeResponse get_self_volume() override;