From 00640370d3b138ef247b5a67a4fc019b968a3cf3 Mon Sep 17 00:00:00 2001 From: Tobias Deiminger Date: Mon, 15 Jul 2019 21:45:28 +0200 Subject: [PATCH] Fix spurious dialogs in PickPointEngine In the case of multiple input events, the local event loop of QInputDialog was processing pending events before m_creationCompleted could be cleared. This allowed recursive calls to PickPointEngine::end, even on wrong events (e.g. MouseMove shouldn't cause end(), but it did). BUG: 409638 BUG: 413990 --- ui/pageviewannotator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp index 51e130e1f..cf6aee149 100644 --- a/ui/pageviewannotator.cpp +++ b/ui/pageviewannotator.cpp @@ -799,6 +799,13 @@ QCursor PageViewAnnotator::cursor() const QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::EventType & eventType, const AnnotatorEngine::Button & button, const QPointF & pos, PageViewItem * item ) { + // creationCompleted is intended to be set by event(), handled subsequently by end(), and cleared within end(). + // If it's set here, we recursed for some reason (e.g., stacked event loop). + // Just bail out, all we want to do is already on stack. + if ( m_engine->creationCompleted() ) { + return QRect(); + } + // if the right mouse button was pressed, we simply do nothing. In this way, we are still editing the annotation // and so this function will receive and process the right mouse button release event too. If we detach now the annotation tool, // the release event will be processed by the PageView class which would create the annotation property widget, and we do not want this.