File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,7 +127,8 @@ namespace {
127127
128128 const char *clipboard_get ()
129129 {
130- std::string data = GetClipboard ();
130+ std::string data;
131+ agi::dispatch::Main ().Sync ([&] { data = GetClipboard (); });
131132 if (data.empty ())
132133 return nullptr ;
133134 return strndup (data);
@@ -137,18 +138,14 @@ namespace {
137138 {
138139 bool succeeded = false ;
139140
140- #if wxUSE_OLE
141- // OLE needs to be initialized on each thread that wants to write to
142- // the clipboard, which wx does not handle automatically
143- wxClipboard cb;
144- #else
145- wxClipboard &cb = *wxTheClipboard;
146- #endif
147- if (cb.Open ()) {
148- succeeded = cb.SetData (new wxTextDataObject (wxString::FromUTF8 (str)));
149- cb.Close ();
150- cb.Flush ();
151- }
141+ agi::dispatch::Main ().Sync ([&] {
142+ wxClipboard &cb = *wxTheClipboard;
143+ if (cb.Open ()) {
144+ succeeded = cb.SetData (new wxTextDataObject (wxString::FromUTF8 (str)));
145+ cb.Close ();
146+ cb.Flush ();
147+ }
148+ });
152149
153150 return succeeded;
154151 }
You can’t perform that action at this time.
0 commit comments