Skip to content

Commit

Permalink
Fix Spline handler crash after hitting Escape and starting a new spline
Browse files Browse the repository at this point in the history
Co-authored-by: TrevorShelton <trevorleeshelton@gmail.com>
Co-authored-by: rolandlo <roland_loetscher@hotmail.com>
  • Loading branch information
3 people committed Apr 29, 2023
1 parent a59b17d commit 9de6b9c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/core/control/tools/SplineHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ constexpr double MAX_TANGENT_LENGTH = 2000.0;
constexpr double MIN_TANGENT_LENGTH = 1.0;

auto SplineHandler::onKeyEvent(GdkEventKey* event) -> bool {
if (!stroke ||
(event->type != GDK_KEY_PRESS && event->keyval != GDK_KEY_Escape)) { // except for escape key only act on key
// press event, not on key release event
if (!stroke || ((event->type != GDK_KEY_PRESS) ==
(event->keyval != GDK_KEY_Escape))) { // except for escape key only act on key
// press event, not on key release event
return false;
}

Expand All @@ -65,7 +65,6 @@ auto SplineHandler::onKeyEvent(GdkEventKey* event) -> bool {
}
case GDK_KEY_BackSpace: {
if (this->knots.size() == 1) {
this->finalizeSpline();
return true;
}
this->deleteLastKnotWithTangent();
Expand Down

0 comments on commit 9de6b9c

Please sign in to comment.