summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefano Facchini <stefano.facchini@gmail.com>2017-10-20 20:40:38 +0000
committerStefano Facchini <stefano.facchini@gmail.com>2017-11-13 09:28:49 +0000
commit2adf86d21d42f7d225e0d2188109fbd031989cf4 (patch)
tree7fa2675fe92d4d05d31aa410d50d6b0934b17f0e /src
parentRefactor SPDesktop::setEventContext to allow for unsetting the current tool (diff)
downloadinkscape-2adf86d21d42f7d225e0d2188109fbd031989cf4.tar.gz
inkscape-2adf86d21d42f7d225e0d2188109fbd031989cf4.zip
Unset the current tool early on shutdown.
Before this commit, when the application is terminated we call the ::finish() method for the current tool, only after deleting the selection and other objects. But it may happen that the tool's finish() assume that the selection is still alive, making the application crash. (For instance, with the Bezier tool when the path is still not closed). Instead, unset the current tool early, when the Desktop object is removed from the application, before calling its ::destroy() method.
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp8
-rw-r--r--src/inkscape.cpp2
-rw-r--r--src/widgets/desktop-widget.cpp3
3 files changed, 4 insertions, 9 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 61a64fe22..f798079fd 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -322,7 +322,6 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid
// canvas_debug = sp_canvas_item_new (main, SP_TYPE_CANVAS_DEBUG, NULL);
}
-
void SPDesktop::destroy()
{
_destroy_signal.emit(this);
@@ -331,6 +330,7 @@ void SPDesktop::destroy()
delete snapindicator;
snapindicator = NULL;
}
+
if (temporary_item_list) {
delete temporary_item_list;
temporary_item_list = NULL;
@@ -356,12 +356,6 @@ void SPDesktop::destroy()
g_signal_handlers_disconnect_by_func(G_OBJECT (main), (gpointer) G_CALLBACK(sp_desktop_root_handler), this);
g_signal_handlers_disconnect_by_func(G_OBJECT (drawing), (gpointer) G_CALLBACK(_arena_handler), this);
- if (event_context) {
- event_context->finish();
- delete event_context;
- event_context = NULL;
- }
-
delete layers;
if (layer_manager) {
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index e7e93929b..b30d06168 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -864,6 +864,8 @@ Application::remove_desktop (SPDesktop * desktop)
g_error("Attempted to remove desktop not in list.");
}
+ desktop->setEventContext("");
+
if (DESKTOP_IS_ACTIVE (desktop)) {
signal_deactivate_desktop.emit(desktop);
if (_desktops->size() > 1) {
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 571f920bf..f9c8e4ac6 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -736,10 +736,9 @@ static void sp_desktop_widget_dispose(GObject *object)
g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->canvas), (gpointer) G_CALLBACK (sp_desktop_widget_event), dtw);
g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->canvas_tbl), (gpointer) G_CALLBACK (canvas_tbl_size_allocate), dtw);
-
dtw->layer_selector->setDesktop(NULL);
dtw->layer_selector->unreference();
- INKSCAPE.remove_desktop (dtw->desktop); // clears selection too
+ INKSCAPE.remove_desktop(dtw->desktop); // clears selection and event_context
dtw->modified_connection.disconnect();
dtw->desktop->destroy();
Inkscape::GC::release (dtw->desktop);