Fix crash when accessing clipboard before entering the main loop.

Check that we have an event loop running before yielding to it.

Notice that we really do need an event loop in wxClipboardSync as events must
be dispatched for the clipboard code to work so while not using the event loop
if it doesn't exist would have fixed a crash as well, it wouldn't allow to use
the clipboard in e.g. wxApp-derived class OnInit().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-03-01 23:45:22 +00:00
parent 06bb8d923d
commit 439c7eae9b

View File

@@ -75,6 +75,10 @@ public:
~wxClipboardSync()
{
// ensure that there is a running event loop: this might not be the
// case if we're called before the main event loop startup
wxEventLoopGuarantor ensureEventLoop;
while (ms_clipboard)
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_CLIPBOARD);
}