[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - vcl/qa vcl/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Dec 9 16:52:15 UTC 2016
vcl/qa/cppunit/timer.cxx | 35 +++++++++++++++++++++++++++++++++++
vcl/source/app/scheduler.cxx | 3 ++-
2 files changed, 37 insertions(+), 1 deletion(-)
New commits:
commit 3be163c72925824eeadf5e75f6e0cf6229d8ceab
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Dec 9 12:12:29 2016 +0200
tdf#100337 Message boxes showup empty with white background
the bug here was that we had, on the stack, going into the scheduler
THREE times. Two of those were idles.
The original code would end up always picking the first idle from inside
ImplSchedulerData::GetMostImportantTask
and then
ImplSchedulerData::Invoke
would just return because we were still inside that Idle, and the second
Idle would never get executed
Since the second Idle was responsible for painting the dialog in the
bug, sometimes the dialog would never get painted.
Change-Id: Ia15b98a06e231c8e1c29450e05a76ad427e41e36
Reviewed-on: https://gerrit.libreoffice.org/31785
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 19a4eaab9a55a2ecb33b727bad6307c5a2badc23)
Reviewed-on: https://gerrit.libreoffice.org/31798
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx
index 07fdc92..ca7a028 100644
--- a/vcl/qa/cppunit/timer.cxx
+++ b/vcl/qa/cppunit/timer.cxx
@@ -66,6 +66,7 @@ public:
#endif
void testRecursiveTimer();
void testSlowTimerCallback();
+ void testTriggerIdleFromIdle();
CPPUNIT_TEST_SUITE(TimerTest);
CPPUNIT_TEST(testIdle);
@@ -80,6 +81,7 @@ public:
#endif
CPPUNIT_TEST(testRecursiveTimer);
CPPUNIT_TEST(testSlowTimerCallback);
+ CPPUNIT_TEST(testTriggerIdleFromIdle);
CPPUNIT_TEST_SUITE_END();
};
@@ -353,6 +355,39 @@ void TimerTest::testSlowTimerCallback()
Application::Yield();
}
+
+class TriggerIdleFromIdle : public Idle
+{
+ bool* mpTriggered;
+ TriggerIdleFromIdle* mpOther;
+public:
+ explicit TriggerIdleFromIdle( bool* pTriggered, TriggerIdleFromIdle* pOther ) :
+ Idle(), mpTriggered(pTriggered), mpOther(pOther)
+ {
+ }
+ virtual void Invoke() override
+ {
+ Start();
+ if (mpOther)
+ mpOther->Start();
+ Application::Yield();
+ if (mpTriggered)
+ *mpTriggered = true;
+ }
+};
+
+void TimerTest::testTriggerIdleFromIdle()
+{
+ bool bTriggered1 = false;
+ bool bTriggered2 = false;
+ TriggerIdleFromIdle aTest2( &bTriggered2, nullptr );
+ TriggerIdleFromIdle aTest1( &bTriggered1, &aTest2 );
+ aTest1.Start();
+ Application::Yield();
+ CPPUNIT_ASSERT_MESSAGE("idle triggered", bTriggered1);
+ CPPUNIT_ASSERT_MESSAGE("idle triggered", bTriggered2);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(TimerTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 4caa4d2..c8f4054 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -33,6 +33,7 @@ void ImplSchedulerData::Invoke()
{
DBG_TESTSOLARMUTEX();
+ assert(!mbInScheduler);
if (mbDelete || mbInScheduler )
return;
@@ -56,7 +57,7 @@ ImplSchedulerData *ImplSchedulerData::GetMostImportantTask( bool bTimerOnly )
sal_uInt64 nTimeNow = tools::Time::GetSystemTicks();
for ( ImplSchedulerData *pSchedulerData = pSVData->mpFirstSchedulerData; pSchedulerData; pSchedulerData = pSchedulerData->mpNext )
{
- if ( !pSchedulerData->mpScheduler || pSchedulerData->mbDelete ||
+ if ( !pSchedulerData->mpScheduler || pSchedulerData->mbDelete || pSchedulerData->mbInScheduler ||
!pSchedulerData->mpScheduler->ReadyForSchedule( bTimerOnly, nTimeNow ) ||
!pSchedulerData->mpScheduler->IsActive())
continue;
More information about the Libreoffice-commits
mailing list