summaryrefslogtreecommitdiff
path: root/src/tools/dcpomatic_batch.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-06-09 23:18:55 +0200
committerCarl Hetherington <cth@carlh.net>2023-06-09 23:20:24 +0200
commit2a7873ffae6e6579b9d794f9f2cd07e07e906a4e (patch)
tree5cff2a2faecadd0f926085ec622df9912936f124 /src/tools/dcpomatic_batch.cc
parent929fedad3dce861bbab00de5bda3125d772f560a (diff)
Don't call DOMFrame::start_job from a non-UI thread.
Diffstat (limited to 'src/tools/dcpomatic_batch.cc')
-rw-r--r--src/tools/dcpomatic_batch.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc
index b73d0a418..24897dfba 100644
--- a/src/tools/dcpomatic_batch.cc
+++ b/src/tools/dcpomatic_batch.cc
@@ -391,12 +391,11 @@ static const wxCmdLineEntryDesc command_line_description[] = {
};
-class JobServer : public Server
+class JobServer : public Server, public Signaller
{
public:
- explicit JobServer (DOMFrame* frame)
+ JobServer()
: Server (BATCH_JOB_PORT)
- , _frame (frame)
{}
void handle (shared_ptr<Socket> socket) override
@@ -406,15 +405,14 @@ public:
scoped_array<char> buffer(new char[length]);
socket->read (reinterpret_cast<uint8_t*>(buffer.get()), length);
string s (buffer.get());
- _frame->start_job (s);
+ emit(boost::bind(boost::ref(StartJob), s));
socket->write (reinterpret_cast<uint8_t const *>("OK"), 3);
} catch (...) {
}
}
-private:
- DOMFrame* _frame;
+ boost::signals2::signal<void(std::string)> StartJob;
};
@@ -469,7 +467,8 @@ class App : public wxApp
_frame->Show ();
try {
- auto server = new JobServer (_frame);
+ auto server = new JobServer();
+ server->StartJob.connect(bind(&DOMFrame::start_job, _frame, _1));
new thread (boost::bind (&JobServer::run, server));
} catch (boost::system::system_error& e) {
error_dialog(_frame, _("Could not listen for new batch jobs. Perhaps another instance of the DCP-o-matic Batch Converter is running."));