[Libreoffice-commits] core.git: vcl/inc vcl/osx vcl/README.scheduler

Jan-Marek Glogowski glogow at fbihome.de
Mon Oct 16 14:05:42 UTC 2017


 vcl/README.scheduler    |    4 ++++
 vcl/inc/osx/saltimer.h  |    1 +
 vcl/osx/salframeview.mm |    3 +++
 vcl/osx/saltimer.cxx    |    8 ++++++++
 4 files changed, 16 insertions(+)

New commits:
commit c69c1ee9d1305c284be48a7a973810da16c15541
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Sat Oct 14 01:43:07 2017 +0200

    tdf#112076 OSX post timeout after shouldCloseWindow
    
    It seems that something filters application defined events when
    closing a window... DoYield expects a timeout event, which never
    arrives, stopping all redraw and generating a busy loop.
    
    Change-Id: Ic83468cceac7b967acaecf18b321178fc7565b94
    Reviewed-on: https://gerrit.libreoffice.org/43381
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/README.scheduler b/vcl/README.scheduler
index 566a88629301..17648ae3b439 100644
--- a/vcl/README.scheduler
+++ b/vcl/README.scheduler
@@ -170,6 +170,10 @@ There is also a workaround for a problem for pushing tasks to an empty queue,
 as [NSApp postEvent: ... atStart: NO] doesn't append the event, if the
 message queue is empty.
 
+An additional problem is the filtering of events on Window close. This drops
+posted timer events, when a Window is closed resulting in a busy DoYield loop,
+so we have to re-post the event, after closing a window.
+
 == Windows implementation details ==
 
 Posted or sent event messages often trigger processing of WndProc in
diff --git a/vcl/inc/osx/saltimer.h b/vcl/inc/osx/saltimer.h
index 65247b930cfa..c860ad5cbdda 100644
--- a/vcl/inc/osx/saltimer.h
+++ b/vcl/inc/osx/saltimer.h
@@ -58,6 +58,7 @@ public:
     void handleStartTimerEvent( NSEvent* pEvent );
     void handleDispatchTimerEvent( NSEvent* pEvent );
     void handleTimerElapsed();
+    void handleWindowShouldClose();
 
     bool IsTimerElapsed() const;
 };
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 1f0a3690bb70..c0d28fe4bc3f 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -369,6 +369,9 @@ static AquaSalFrame* getMouseContainerFrame()
         {
             mpFrame->CallCallback( SalEvent::Close, nullptr );
             bRet = NO; // application will close the window or not, AppKit shouldn't
+            AquaSalTimer *pTimer = static_cast<AquaSalTimer*>( ImplGetSVData()->maSchedCtx.mpSalTimer );
+            assert( pTimer );
+            pTimer->handleWindowShouldClose();
         }
     }
 
diff --git a/vcl/osx/saltimer.cxx b/vcl/osx/saltimer.cxx
index 877fdfae85b5..3226b1d1f9ec 100644
--- a/vcl/osx/saltimer.cxx
+++ b/vcl/osx/saltimer.cxx
@@ -196,4 +196,12 @@ AquaSalTimer::~AquaSalTimer()
     Stop();
 }
 
+void AquaSalTimer::handleWindowShouldClose()
+{
+    // for whatever reason events get filtered on close, presumely by
+    // timestamp so post a new timeout event, if there was one queued...
+    if ( ExistsValidEvent() && !m_pRunningTimer )
+        queueDispatchTimerEvent( NO );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list