Work around deadlock when destroying J2KEncoder with a full writer queue (#2784).
[dcpomatic.git] / src / wx / fonts_dialog.cc
index 14fb368d3a31d5e09fa33c8e1507db502f821d4a..2fecdc086433996267e0a9dc6ef8959697cc5bc9 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/content.h"
 #include "lib/font.h"
 #include "lib/text_content.h"
+#include <dcp/filesystem.h>
 #include <dcp/warnings.h>
 LIBDCP_DISABLE_WARNINGS
 #include <wx/wx.h>
@@ -119,7 +120,7 @@ FontsDialog::setup ()
                _fonts->SetItem(n, 0, id);
                _fonts->SetItemData(n, i->id().empty());
                if (i->file()) {
-                       _fonts->SetItem(n, 1, i->file()->leaf().string());
+                       _fonts->SetItem(n, 1, i->file()->filename().string());
                }
                ++n;
        }
@@ -173,7 +174,7 @@ FontsDialog::set_from_file_clicked ()
         */
         wxString default_dir = "";
 #ifdef DCPOMATIC_LINUX
-        if (boost::filesystem::exists ("/usr/share/fonts/truetype")) {
+        if (dcp::filesystem::exists("/usr/share/fonts/truetype")) {
                 default_dir = "/usr/share/fonts/truetype";
         } else {
                 default_dir = "/usr/share/fonts";
@@ -183,17 +184,13 @@ FontsDialog::set_from_file_clicked ()
         default_dir = "/System/Library/Fonts";
 #endif
 
-       auto d = new wxFileDialog (this, _("Choose a font file"), default_dir, wxT(""), wxT("*.ttf;*.otf;*.ttc"), wxFD_CHANGE_DIR);
-       int const r = d->ShowModal ();
+       auto d = make_wx<wxFileDialog>(this, _("Choose a font file"), default_dir, wxT(""), wxT("*.ttf;*.otf;*.ttc"), wxFD_CHANGE_DIR);
 
-       if (r != wxID_OK) {
-               d->Destroy ();
+       if (d->ShowModal() != wxID_OK) {
                return;
        }
 
        font->set_file (wx_to_std(d->GetPath()));
-       d->Destroy ();
-
        setup ();
 }
 
@@ -206,15 +203,13 @@ FontsDialog::set_from_system_font_clicked()
                return;
        }
 
-       auto dialog = new SystemFontDialog(this);
-       auto const r = dialog->ShowModal();
-       if (r == wxID_OK) {
+       auto dialog = make_wx<SystemFontDialog>(this);
+       if (dialog->ShowModal() == wxID_OK) {
                auto font_file = dialog->get_font();
                if (font_file) {
                        font->set_file(*font_file);
                }
        }
 
-       dialog->Destroy();
        setup ();
 }