diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-09-03 00:28:35 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-09-03 00:28:35 +0100 |
| commit | 6788ff5967508056d1321c16143bf72fa7cd4516 (patch) | |
| tree | 8fe76f1a8038e6bc0cb3ef07633568e5da43887f /src | |
| parent | 0390c42a7fc648a116ac3fd0417eac92dfe79f6d (diff) | |
Speculative fix for Doremi certificate download on OS X.
The while (wxTheApp->Pending ()) wxTheApp->Dispatch() appears to
hang on OS X.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/ui_signaller.h | 7 | ||||
| -rw-r--r-- | src/wx/doremi_certificate_dialog.cc | 13 | ||||
| -rw-r--r-- | src/wx/doremi_certificate_dialog.h | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/src/lib/ui_signaller.h b/src/lib/ui_signaller.h index 1d62547f6..ee4d230d4 100644 --- a/src/lib/ui_signaller.h +++ b/src/lib/ui_signaller.h @@ -54,8 +54,15 @@ public: } } + /* Do something next time the UI is idle */ + template <typename T> + void when_idle (T f) { + _service.post (f); + } + /** Call this in the UI when it is idle */ size_t ui_idle () { + /* This executes any functors that have been post()ed to _service */ return _service.poll (); } diff --git a/src/wx/doremi_certificate_dialog.cc b/src/wx/doremi_certificate_dialog.cc index b4cd14eaf..4b5d58b37 100644 --- a/src/wx/doremi_certificate_dialog.cc +++ b/src/wx/doremi_certificate_dialog.cc @@ -21,6 +21,7 @@ #include <zip.h> #include "lib/compose.hpp" #include "lib/util.h" +#include "lib/ui_signaller.h" #include "lib/internet.h" #include "doremi_certificate_dialog.h" #include "wx_util.h" @@ -51,8 +52,18 @@ DoremiCertificateDialog::download () } _message->SetLabel (_("Downloading certificate")); - run_gui_loop (); +#ifdef DCPOMATIC_OSX + /* This is necessary on OS X, otherwise the SetLabel() above has no visible effect */ + wxMilliSleep (200); +#endif + + ui_signaller->when_idle (boost::bind (&DoremiCertificateDialog::finish_download, this, serial)); +} + +void +DoremiCertificateDialog::finish_download (string serial) +{ /* Try dcp2000, imb and ims prefixes (see mantis #375) */ optional<string> error = get_from_zip_url ( diff --git a/src/wx/doremi_certificate_dialog.h b/src/wx/doremi_certificate_dialog.h index 281184726..b249736ec 100644 --- a/src/wx/doremi_certificate_dialog.h +++ b/src/wx/doremi_certificate_dialog.h @@ -28,5 +28,7 @@ private: void download (); void set_sensitivity (); + void finish_download (std::string serial); + wxTextCtrl* _serial; }; |
