uitest/libreoffice/uno/eventlistener.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 911502799bdc69d010777ebc4d93a0ff3810620b
Author:     Neil Roberts <[email protected]>
AuthorDate: Thu Dec 11 18:24:03 2025 +0100
Commit:     Neil Roberts <[email protected]>
CommitDate: Fri Dec 12 09:01:14 2025 +0100

    uitest/EventListener: Set executed flag after storing event details
    
    Most of the uses of the EventListener wait for the executed flag to be
    set in a check-sleep loop. If the code then tries to access properties
    of the listener such as the supplements array then there was a race
    condition where the waiting thread might wake up in between the time
    that the executed flag is set and the details are filled in. This can
    happen for example in open_subcomponent_through_command. I can replicate
    this problem locally by adding a short sleep after setting executed to
    True.
    
    This is likely the cause of build failures such as the following:
    
    https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/194139/
    
    This patch just changes the order so that the executed flag is only set
    after the event details are filled in.
    
    Change-Id: I9ba108bc2e2fa084fd5d9e3048e34203feaa74a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195483
    Tested-by: Jenkins
    Reviewed-by: Neil Roberts <[email protected]>

diff --git a/uitest/libreoffice/uno/eventlistener.py 
b/uitest/libreoffice/uno/eventlistener.py
index dd1fcdaeae06..6693f92cd47e 100644
--- a/uitest/libreoffice/uno/eventlistener.py
+++ b/uitest/libreoffice/uno/eventlistener.py
@@ -40,9 +40,9 @@ class EventListener(XDocumentEventListener,unohelper.Base):
         print("documentEventOccured: name=" + event.EventName + ", title=" + 
str(event.Supplement))
         print("documentEventOccured: found event we are waiting for")
         if event.EventName in self.eventNames:
-            self.executed = True
             self.eventExecuted.append(event.EventName)
             self.supplements.append(event.Supplement)
+            self.executed = True
 
     def hasExecuted(self, eventName):
         return eventName in self.eventExecuted

Reply via email to