From 69075043f16e8fe29eb292946562db2f52399e3d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 12 Oct 2017 17:13:36 +0200 Subject: [PATCH] Fix uninitialized AccessibilityWatcher::mActive variable This fixes the lost of focus tracking when zooming in/out several times. mActive is tested in AccessibilityWatcher::setActive() but was never initialized or updated, and thus basically random. By luck it'd be 0, and thus AccessibilityWatcher::setActive would always accept to reactivate and never accept to deactivate. But without luck it'd be non-0, and thus AccessibilityWatcher::setActive would always accept to desactivate, but always refuse to reactivate (e.g. when zooming in). --- plugins/focuspoll/src/accessibilitywatcher.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/focuspoll/src/accessibilitywatcher.cpp b/plugins/focuspoll/src/accessibilitywatcher.cpp index a7ac4d008..2c5cdb455 100644 --- a/plugins/focuspoll/src/accessibilitywatcher.cpp +++ b/plugins/focuspoll/src/accessibilitywatcher.cpp @@ -33,6 +33,7 @@ bool AccessibilityWatcher::ignoreLinks = false; AccessibilityWatcher::AccessibilityWatcher () : initialized (false), + mActive (false), screenWidth (0), screenHeight (0), optimizedPaths ({{}}), @@ -686,6 +687,7 @@ void AccessibilityWatcher::addWatches () { atspi_event_listener_register (selectedListener, "object:state-changed:selected", NULL); atspi_event_listener_register (descendantChangedListener, "object:active-descendant-changed", NULL); atspi_event_listener_register (globalListener, "object:", NULL); + mActive = true; } void AccessibilityWatcher::removeWatches () { @@ -698,6 +700,7 @@ void AccessibilityWatcher::removeWatches () { atspi_event_listener_deregister (selectedListener, "object:state-changed:selected", NULL); // deprecation in stretch? atspi_event_listener_deregister (descendantChangedListener, "object:active-descendant-changed", NULL); atspi_event_listener_deregister (globalListener, "object:", NULL); + mActive = false; } void AccessibilityWatcher::init () { -- GitLab