Fix segfault in Remove Spline Point context menu

This was incorrectly capturing `r` by reference and using it after it left
its scope. Changed to  capture by value, and also explicitly capture `this`
in case we were accidentally capturing any other scope variables by reference.

Fixes #571
pull/574/head
Tim 2020-03-28 15:28:12 +00:00 committed by GitHub
parent f7b6f6930e
commit 485fd012b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -647,7 +647,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
int index = r->IndexOfPoint(gs.point[0]);
if((r->type == Request::Type::CUBIC && (index > 1 && index < r->extraPoints + 2)) ||
r->type == Request::Type::CUBIC_PERIODIC) {
menu->AddItem(_("Remove Spline Point"), [&]() {
menu->AddItem(_("Remove Spline Point"), [this, r]() {
int index = r->IndexOfPoint(gs.point[0]);
ssassert(r->extraPoints != 0,
"Expected a bezier with interior control points");