summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qlockfile
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2023-03-10 17:04:16 +0100
committerAxel Spoerl <axel.spoerl@qt.io>2023-03-14 21:15:31 +0100
commit425e635ecd8d588a87da66a1ef89fbf9ef469f1e (patch)
treeac0fd88eb66d4b9d6e63bf85c50c7a1120c35db5 /tests/auto/corelib/io/qlockfile
parentc99614711ed9df0d7b942585a258537c9d12d298 (diff)
QCompleter::setPopup() - refactor and cleanup
QCompleter::setPopup() sets window flags, focus policy, parent, focus proxy, item delate and installs an event filter, before the popup argument is assigned to d->popup. In the QCompleter::eventFilter override, QObject::eventFilter is called (under more) if d->popup is nullptr. If a custom class is inherited from QCompleter and it overrides QObject::eventFilter(), this causes an infinite loop. This patch re-factors the method. - early return is added if the new popup != d->popup - remembering the existing widget's focus policy is constified and moved ahead of the delete secion. - assignment of d->popup to popup argument is moved after the delete section. - after assignment, the argument variable is no longer used. The refactoring eliminates two issues: - potential risk of double-installing event filter due to missing early return. - inifite loop if inherited class installs another event filter. The patch adds a test function to tst_QCompleter, which implements an inherited class, installs an event filter on a popup and checks if a ChildAdded event hass been recorded. Fixes: QTBUG-111869 Pick-to: 6.5 6.2 Change-Id: I3f7a2434a11476077a5260e7686a912da9f6c60d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qlockfile')
0 files changed, 0 insertions, 0 deletions