From 978eafdf10ab389637666a47c87a473b3968b7c2 Mon Sep 17 00:00:00 2001 From: avee12x2 Date: Mon, 24 Mar 2025 04:35:13 +0530 Subject: [PATCH] Fix crash when selecting keyboard shortcut file Inkscape was crashing when selecting keyboard shortcut files in Preferences. The issue occurred because the program attempted to update Quick Preview and Quick Zoom labels even when these shortcuts were missing. Also fixed a bug where these labels were always initialized with 'Q' and 'F', regardless of the actual shortcut settings. Fixes: https://gitlab.com/inkscape/inkscape/-/issues/5538 --- src/ui/widget/canvas-grid.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ui/widget/canvas-grid.cpp b/src/ui/widget/canvas-grid.cpp index 72de2308c7..e8751848a4 100644 --- a/src/ui/widget/canvas-grid.cpp +++ b/src/ui/widget/canvas-grid.cpp @@ -164,17 +164,29 @@ CanvasGrid::CanvasGrid(SPDesktopWidget *dtw) if (!quick_preview_shortcut.empty()) { _quick_preview_label->set_label("" + quick_preview_shortcut[0] + ""); + } else { + _quick_preview_label->set_label(""); } if (!quick_zoom_shortcut.empty()) { _quick_zoom_label->set_label("" + quick_zoom_shortcut[0] + ""); + } else { + _quick_zoom_label->set_label(""); } _update_preview_connection = _preview_accel.connectModified([this]() { + if(_preview_accel.getShortcutText().empty()) { + _quick_preview_label->set_label(""); + return; + } _quick_preview_label->set_label("" + _preview_accel.getShortcutText()[0] + ""); }); _update_zoom_connection = _zoom_accel.connectModified([this]() { + if(_zoom_accel.getShortcutText().empty()) { + _quick_zoom_label->set_label(""); + return; + } _quick_zoom_label->set_label("" + _zoom_accel.getShortcutText()[0] + ""); }); -- GitLab