From daa59b89b1f05cf3a2abdee9ef5ac8bffe805b13 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 12 Jan 2019 20:39:23 +0100 Subject: Fix multithreading crashes --- include/ChatWindow.hpp | 4 +++- include/Window.hpp | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/ChatWindow.hpp b/include/ChatWindow.hpp index 764ca32..1ca473b 100644 --- a/include/ChatWindow.hpp +++ b/include/ChatWindow.hpp @@ -65,6 +65,8 @@ namespace dchat { Gtk::Grid *leftPanelUsersLayout; Gtk::Grid *messageAreaLayout; + uint numMessages; + uint numUsers; Gtk::RadioButton *button; }; @@ -76,4 +78,4 @@ namespace dchat bool chatInputShowPlaceholder; bool chatInputChangeByPlaceholder; }; -} \ No newline at end of file +} diff --git a/include/Window.hpp b/include/Window.hpp index 645b578..b33605b 100644 --- a/include/Window.hpp +++ b/include/Window.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace dchat @@ -33,6 +34,7 @@ namespace dchat void draw(const Cairo::RefPtr &cairo) { Gtk::Overlay::draw(cairo); } }; + std::thread::id mainThreadId; std::mutex databaseCallbackMutex; OverlayDrawable overlay; Gtk::Stack stack; @@ -58,7 +60,7 @@ namespace dchat sigc::connection drawBackgroundConnection; Glib::Dispatcher dispatcher; - std::mutex dispatcherMutex; + std::recursive_mutex dispatcherMutex; std::vector dispatcherHandlers; }; -} \ No newline at end of file +} -- cgit v1.2.3