Make Application::ProcessEvents() static.

This commit is contained in:
Gunnar Beutner 2013-02-13 07:25:36 +01:00
parent d744f9fb7c
commit 2893134940
3 changed files with 4 additions and 14 deletions

View File

@ -91,7 +91,7 @@ Application::Ptr Application::GetInstance(void)
* *
* @returns false if we're shutting down, true otherwise. * @returns false if we're shutting down, true otherwise.
*/ */
bool Application::ProcessEvents(void) const bool Application::ProcessEvents(void)
{ {
Object::ClearHeldObjects(); Object::ClearHeldObjects();

View File

@ -76,7 +76,7 @@ public:
static String GetPkgDataDir(void); static String GetPkgDataDir(void);
static void SetPkgDataDir(const String& path); static void SetPkgDataDir(const String& path);
bool ProcessEvents(void) const; static bool ProcessEvents(void);
protected: protected:
void RunEventLoop(void) const; void RunEventLoop(void) const;

View File

@ -522,17 +522,7 @@ bool Utility::Glob(const String& pathSpec, const function<void (const String&)>&
*/ */
void Utility::WaitUntil(const function<bool (void)>& predicate) void Utility::WaitUntil(const function<bool (void)>& predicate)
{ {
while (!predicate()) { while (!predicate())
Application::Ptr instance = Application::GetInstance(); Application::ProcessEvents();
/* Waiting for a predicate requires an application instance.
* This means we cannot do certain asynchronous things
* (like spawning a process) until the application instance
* has been initialized. */
if (!instance)
BOOST_THROW_EXCEPTION(runtime_error("Waiting for predicate failed: Application instance is not initialized."));
instance->ProcessEvents();
}
} }