diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-10-08 10:43:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-08 10:43:56 +0100 |
commit | 06d253ef3a3339300eff4fd38db728301516bf4d (patch) | |
tree | 10088b87d53a9aac8855cb6f56b0676bdf40a5bd /vcl/source | |
parent | 4855e780dc4f3cdfcadbce07b6bbdeb9b4eb2d0b (diff) |
afl-eventtesting: add Application::EndAllDialogs
which uses PostUserEvent like Application::Quit so can ensure
EndAllDialogs gets called before Quit
Change-Id: I9eb7dbd4f012be2e9b9cea7a73c90c5aaba141aa
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/svapp.cxx | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 2c017443da6f..94ebc6e16092 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -328,6 +328,21 @@ const vcl::KeyCode* Application::GetReservedKeyCode( sal_uLong i ) return &ImplReservedKeys::get()->first[i].mKeyCode; } +IMPL_STATIC_LINK_NOARG_TYPED( ImplSVAppData, ImplEndAllDialogsMsg, void*, void ) +{ + vcl::Window* pAppWindow = Application::GetFirstTopLevelWindow(); + while (pAppWindow) + { + Dialog::EndAllDialogs(pAppWindow); + pAppWindow = Application::GetNextTopLevelWindow(pAppWindow); + } +} + +void Application::EndAllDialogs() +{ + Application::PostUserEvent( LINK( NULL, ImplSVAppData, ImplEndAllDialogsMsg ) ); +} + namespace { bool InjectKeyEvent(SvStream& rStream) @@ -351,14 +366,8 @@ namespace void CloseDialogsAndQuit() { - Scheduler::ProcessTaskScheduling(true); - vcl::Window* pAppWindow = Application::GetFirstTopLevelWindow(); - while (pAppWindow) - { - Dialog::EndAllDialogs(pAppWindow); - pAppWindow = Application::GetNextTopLevelWindow(pAppWindow); - } - Scheduler::ProcessTaskScheduling(true); + Scheduler::ProcessTaskScheduling(false); + Application::EndAllDialogs(); Application::Quit(); } } @@ -375,7 +384,7 @@ IMPL_LINK_NOARG_TYPED(ImplSVAppData, VclEventTestingHdl, Idle *, void) } else { - Scheduler::ProcessTaskScheduling(true); + Scheduler::ProcessTaskScheduling(false); if (InjectKeyEvent(*mpEventTestInput)) --mnEventTestLimit; if (!mpEventTestInput->good()) @@ -383,7 +392,7 @@ IMPL_LINK_NOARG_TYPED(ImplSVAppData, VclEventTestingHdl, Idle *, void) SAL_INFO("vcl.eventtesting", "Event Input exhausted, exit next cycle"); mnEventTestLimit = 0; } - Scheduler::ProcessTaskScheduling(true); + Scheduler::ProcessTaskScheduling(false); mpEventTestingIdle->Start(); } } |