X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c54277e538b22e5b388030c70b47d050455432f..e8fd252ef87d8ff6409d405218ff02c91b980e0a:/src/gtk/clipbrd.cpp diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index a3544a4103..924f7c88c0 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -75,6 +75,11 @@ public: ~wxClipboardSync() { +#if wxUSE_CONSOLE_EVENTLOOP + // 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; +#endif while (ms_clipboard) wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_CLIPBOARD); } @@ -481,11 +486,7 @@ GdkAtom wxClipboard::GTKGetClipboardAtom() const void wxClipboard::GTKClearData(Kind kind) { wxDataObject *&data = Data(kind); - if ( data ) - { - delete data; - data = NULL; - } + wxDELETE(data); } bool wxClipboard::SetSelectionOwner(bool set) @@ -670,10 +671,11 @@ bool wxClipboard::GetData( wxDataObject& data ) { wxCHECK_MSG( m_open, false, wxT("clipboard not open") ); - // get all supported formats from wxDataObjects - const size_t count = data.GetFormatCount(); + // get all supported formats from wxDataObjects: notice that we are setting + // the object data, so we need them in "Set" direction + const size_t count = data.GetFormatCount(wxDataObject::Set); wxDataFormatArray formats(new wxDataFormat[count]); - data.GetAllFormats(formats.get()); + data.GetAllFormats(formats.get(), wxDataObject::Set); for ( size_t i = 0; i < count; i++ ) {