From b432d856ae5a477479194c2bda313a3df2008804 Mon Sep 17 00:00:00 2001 From: Ulrich Huber Date: Tue, 4 Jun 2019 20:17:35 +0200 Subject: [PATCH 1/2] Fix image tool leaving input system in invalid state --- src/gui/inputdevices/PenInputHandler.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/inputdevices/PenInputHandler.cpp b/src/gui/inputdevices/PenInputHandler.cpp index 1b3d97a3..d07106b7 100644 --- a/src/gui/inputdevices/PenInputHandler.cpp +++ b/src/gui/inputdevices/PenInputHandler.cpp @@ -105,21 +105,29 @@ bool PenInputHandler::actionStart(InputEvent* event) // set reference data for handling of entering/leaving page this->updateLastEvent(event); - // Flag running input - this->inputRunning = true; - this->penInWidget = true; - // Change the tool depending on the key changeTool(event); + // Flag running input + ToolHandler* toolHandler = this->inputContext->getToolHandler(); + ToolType toolType = toolHandler->getToolType(); + + // + if (toolType != TOOL_IMAGE) + { + this->inputRunning = true; + } else { + this->deviceClassPressed = false; + } + + this->penInWidget = true; + GtkXournal* xournal = this->inputContext->getXournal(); XournalppCursor* cursor = xournal->view->getCursor(); cursor->setMouseDown(true); - ToolHandler* toolHandler = this->inputContext->getToolHandler(); - ToolType toolType = toolHandler->getToolType(); // Save the starting offset when hand-tool is selected to get a reference for the scroll-offset if (toolType == TOOL_HAND) @@ -371,6 +379,7 @@ bool PenInputHandler::actionEnd(InputEvent* event) } this->inputRunning = false; + delete this->lastHitEvent; this->lastHitEvent = nullptr; return false; From 999f095b2079cd6f9138e1b7d0171d921cab2db0 Mon Sep 17 00:00:00 2001 From: Ulrich Huber Date: Tue, 4 Jun 2019 20:23:33 +0200 Subject: [PATCH 2/2] Delete DeviceClassConfigGui in SettingsDialog destructor --- src/gui/dialog/SettingsDialog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/dialog/SettingsDialog.cpp b/src/gui/dialog/SettingsDialog.cpp index cf6cd756..f730c350 100644 --- a/src/gui/dialog/SettingsDialog.cpp +++ b/src/gui/dialog/SettingsDialog.cpp @@ -136,6 +136,12 @@ SettingsDialog::~SettingsDialog() } this->buttonConfigs.clear(); + for (DeviceClassConfigGui* dev : this->deviceClassConfigs) + { + delete dev; + } + this->deviceClassConfigs.clear(); + // DO NOT delete settings! this->settings = NULL;