File 0001-Fix-crash-when-Wait-for-validation-is-not-enabled.patch of Package kgeography

From 954c1a2d5664beb605925c0f7ca4045150e077d1 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Tue, 13 Apr 2021 23:13:41 +0200
Subject: [PATCH] Fix crash when "Wait for validation" is not enabled

Qt is not happy that we're deleting a radio button from a slot connected
to QAbstractButton::toggled, which makes sense, since it's probably not
finished internally, so now we do a delayed invokation of
boxAsker::checkAnswer that is the method that may ultimately end up
deleting the radio button, but this way it runs when Qt is finished
processing the toggled change

BUGS: 435555
---
 src/boxasker.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/boxasker.cpp b/src/boxasker.cpp
index 6e75f72..56ff4db 100644
--- a/src/boxasker.cpp
+++ b/src/boxasker.cpp
@@ -217,7 +217,7 @@ void boxAsker::nextQuestionHook(const division *div)
 void boxAsker::atLeastOneSelected()
 {
 	if ( ! kgeographySettings::self() -> waitsForValidation() )
-		checkAnswer();
+		QMetaObject::invokeMethod(this, &boxAsker::checkAnswer, Qt::QueuedConnection);
 	else
 		p_accept -> setEnabled(true);
 }
-- 
GitLab
openSUSE Build Service is sponsored by