From fe4199dace73ee38262528f7ae88cbfba99120dd Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 31 Dec 2018 12:01:59 +0100 Subject: Make thread-safe --- include/Window.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/Window.hpp') diff --git a/include/Window.hpp b/include/Window.hpp index 4355fb8..645b578 100644 --- a/include/Window.hpp +++ b/include/Window.hpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace dchat { @@ -22,7 +23,9 @@ namespace dchat std::shared_ptr rooms; WindowNotification *windowNotification; private: + using DispatcherHandler = std::function; bool drawBackground(const Cairo::RefPtr &cairo); + void dispatchFunction(DispatcherHandler func); private: class OverlayDrawable : public Gtk::Overlay { @@ -53,5 +56,9 @@ namespace dchat std::vector backgroundNodes; int prevTimeMillis; sigc::connection drawBackgroundConnection; + + Glib::Dispatcher dispatcher; + std::mutex dispatcherMutex; + std::vector dispatcherHandlers; }; } \ No newline at end of file -- cgit v1.2.3