diff --git a/src/Instance.hxx b/src/Instance.hxx index 8d5bd975a..f411a0e89 100644 --- a/src/Instance.hxx +++ b/src/Instance.hxx @@ -23,7 +23,6 @@ #include "check.h" #include "event/Loop.hxx" #include "event/MaskMonitor.hxx" -#include "GlobalEvents.hxx" #include "Compiler.h" #ifdef ENABLE_NEIGHBOR_PLUGINS @@ -66,8 +65,6 @@ struct Instance final public NeighborListener #endif { - GlobalEvents::Monitor global_events; - CallbackMaskMonitor idle_monitor; #ifdef ENABLE_NEIGHBOR_PLUGINS @@ -93,8 +90,7 @@ struct Instance final StateFile *state_file; Instance() - :global_events(event_loop), - idle_monitor(event_loop, *this, &Instance::OnIdle) {} + :idle_monitor(event_loop, *this, &Instance::OnIdle) {} /** * Initiate shutdown. Wrapper for EventLoop::Break(). diff --git a/src/Partition.cxx b/src/Partition.cxx index 2bbad1283..573fdc718 100644 --- a/src/Partition.cxx +++ b/src/Partition.cxx @@ -29,7 +29,9 @@ Partition::Partition(Instance &_instance, unsigned max_length, unsigned buffer_chunks, unsigned buffered_before_play) - :instance(_instance), playlist(max_length, *this), + :instance(_instance), + global_events(instance.event_loop), + playlist(max_length, *this), outputs(*this), pc(*this, outputs, buffer_chunks, buffered_before_play) { @@ -95,13 +97,13 @@ Partition::OnQueueSongStarted() void Partition::OnPlayerSync() { - instance.global_events.Emit(GlobalEvents::PLAYLIST); + global_events.Emit(GlobalEvents::PLAYLIST); } void Partition::OnPlayerTagModified() { - instance.global_events.Emit(GlobalEvents::TAG); + global_events.Emit(GlobalEvents::TAG); } void diff --git a/src/Partition.hxx b/src/Partition.hxx index 6e72bf3ab..ca1e6a9d2 100644 --- a/src/Partition.hxx +++ b/src/Partition.hxx @@ -20,6 +20,7 @@ #ifndef MPD_PARTITION_HXX #define MPD_PARTITION_HXX +#include "GlobalEvents.hxx" #include "queue/Playlist.hxx" #include "queue/Listener.hxx" #include "output/MultipleOutputs.hxx" @@ -40,6 +41,8 @@ class SongLoader; struct Partition final : QueueListener, PlayerListener, MixerListener { Instance &instance; + GlobalEvents::Monitor global_events; + struct playlist playlist; MultipleOutputs outputs; diff --git a/src/PlaylistGlobal.cxx b/src/PlaylistGlobal.cxx index 837d0acfe..f88d96482 100644 --- a/src/PlaylistGlobal.cxx +++ b/src/PlaylistGlobal.cxx @@ -26,6 +26,7 @@ #include "PlaylistGlobal.hxx" #include "Main.hxx" #include "Instance.hxx" +#include "Partition.hxx" static void playlist_tag_event(void) @@ -42,6 +43,6 @@ playlist_event(void) void playlist_global_init() { - instance->global_events.Register(GlobalEvents::TAG, playlist_tag_event); - instance->global_events.Register(GlobalEvents::PLAYLIST, playlist_event); + instance->partition->global_events.Register(GlobalEvents::TAG, playlist_tag_event); + instance->partition->global_events.Register(GlobalEvents::PLAYLIST, playlist_event); }