From 905a9b962b1464cf2f293b21634d4aa665c009ab Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 4 Nov 2018 03:44:11 +0100 Subject: Fix crash when creating room when user is not a member of any other room --- src/Window.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Window.cpp') diff --git a/src/Window.cpp b/src/Window.cpp index b5a9f26..22e5501 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -1,6 +1,5 @@ #include "../include/Window.hpp" #include -#include "../include/WindowNotification.hpp" #include #include #include @@ -11,10 +10,11 @@ namespace dchat const int nodesPerColumn = 10; const int nodesPerRow = 10; - Window::Window() + Window::Window() : + chatWindow(this) { set_border_width(0); - WindowNotification *windowNotification = Gtk::manage(new WindowNotification()); + windowNotification = Gtk::manage(new WindowNotification()); overlay.add_overlay(*windowNotification); overlay.set_overlay_pass_through(*windowNotification); overlay.add(stack); @@ -31,7 +31,7 @@ namespace dchat //chatWindow.show_all(); //loginWindow.show(); - loginWindow.setLoginHandler([this, windowNotification](const Glib::ustring &username, const Glib::ustring &password) + loginWindow.setLoginHandler([this](const Glib::ustring &username, const Glib::ustring &password) { if(!rooms || !rooms->database) { @@ -57,7 +57,7 @@ namespace dchat } }); - loginWindow.setRegisterHandler([this, windowNotification](const Glib::ustring &username, const Glib::ustring &password) + loginWindow.setRegisterHandler([this](const Glib::ustring &username, const Glib::ustring &password) { if(!rooms || !rooms->database) { @@ -84,13 +84,13 @@ namespace dchat } }); - loginWindow.setRegisterPasswordMismatch([windowNotification] + loginWindow.setRegisterPasswordMismatch([this] { windowNotification->show("Passwords do not match"); }); RoomCallbackFuncs roomCallbackFuncs; - roomCallbackFuncs.connectCallbackFunc = [this, windowNotification](std::shared_ptr rooms, const char *errMsg) + roomCallbackFuncs.connectCallbackFunc = [this](std::shared_ptr rooms, const char *errMsg) { this->rooms = rooms; if(rooms) -- cgit v1.2.3