From fb992706b0cd8a209534ebfdfc595dc3d1bd87ad Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 16 Jan 2019 13:52:26 +0100 Subject: Make InkscapeWindow responsible for adding window to app. Prevents premature program termination if original window deleted. --- src/inkscape-window.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/inkscape-window.cpp') diff --git a/src/inkscape-window.cpp b/src/inkscape-window.cpp index 7227993cf..e6f488215 100644 --- a/src/inkscape-window.cpp +++ b/src/inkscape-window.cpp @@ -18,12 +18,26 @@ #include "inkscape-window.h" #include "inkscape.h" // SP_ACTIVE_DESKTOP #include "shortcuts.h" +#include "inkscape-application.h" #include "widgets/desktop-widget.h" InkscapeWindow::InkscapeWindow(SPDocument* document) : _document(document) { + if (!_document) { + std::cerr << "InkscapeWindow::InkscapeWindow: null document!" << std::endl; + return; + } + + Glib::RefPtr gio_app = Gio::Application::get_default(); + Glib::RefPtr app = Glib::RefPtr::cast_dynamic(gio_app); + if (app) { + set_application(app); // Same as Gtk::Application::add_window() + } else { + std::cerr << "InkscapeWindow::InkscapeWindow:: Didn't get app!" << std::endl; + } + set_resizable(true); // Callbacks -- cgit v1.2.3