Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2022-09-30 16:58:11 +0300
committerJonathan White <support@dmapps.us>2022-10-17 02:17:02 +0300
commitfaa4c070952ebaf99b366a83bf865e889b44a21d (patch)
tree7487bb4ea950d79d67ed66af1c4327529e61edd3
parent245dccf91c969f06078f2ffc21d0c8664c328304 (diff)
Fix crash when application is unfocused during saves
* Fix #8504
-rw-r--r--src/gui/DatabaseWidget.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index 397009a88..c10f6212b 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -1620,13 +1620,18 @@ bool DatabaseWidget::focusNextPrevChild(bool next)
// [parent] <-> GroupView <-> TagView <-> EntryView <-> EntryPreview <-> [parent]
QList<QWidget*> sequence = {m_groupView, m_tagView, m_entryView, m_previewView};
auto widget = qApp->focusWidget();
+ if (!widget) {
+ return QStackedWidget::focusNextPrevChild(next);
+ }
+ // Find the nearest parent widget in the sequence list
int idx;
do {
idx = sequence.indexOf(widget);
widget = widget->parentWidget();
} while (idx == -1 && widget);
+ // Determine next/previous or wrap around
if (idx == -1) {
idx = next ? 0 : sequence.size() - 1;
} else {
@@ -1636,7 +1641,7 @@ bool DatabaseWidget::focusNextPrevChild(bool next)
// Find the next visible element in the sequence and set the focus
while (idx >= 0 && idx < sequence.size()) {
widget = sequence[idx];
- if (widget->isVisible() && widget->height() > 0 && widget->width() > 0) {
+ if (widget && widget->isVisible() && widget->height() > 0 && widget->width() > 0) {
widget->setFocus();
return widget;
}