From b1dc9c3a2f7e55c9afc5bf2d5b465371b048e14f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 10 Aug 2016 16:38:33 +0100 Subject: Remove all use of stringstream in an attempt to fix the suspected thread-unsafe crash bugs on OS X. --- src/tools/dcpomatic.cc | 10 ++++++---- src/tools/dcpomatic_kdm_cli.cc | 7 +++---- src/tools/dcpomatic_server.cc | 4 +--- 3 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/tools') diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index cd827016d..7c7b39b04 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -75,6 +75,7 @@ #include #include #include +/* This is OK as it's only used with DCPOMATIC_WINDOWS */ #include #ifdef check @@ -900,12 +901,13 @@ private: } for (size_t i = 0; i < history.size(); ++i) { - locked_stringstream s; + string s; if (i < 9) { - s << "&" << (i + 1) << " "; + s = String::compose ("&%1 %2", i + 1, history[i].string()); + } else { + s = history[i].string(); } - s << history[i].string(); - _file_menu->Insert (pos++, ID_file_history + i, std_to_wx (s.str ())); + _file_menu->Insert (pos++, ID_file_history + i, std_to_wx (s)); } _history_items = history.size (); diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index de89a9c7c..5126e1954 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -29,7 +29,6 @@ #include "lib/config.h" #include "lib/exceptions.h" #include "lib/emailer.h" -#include #include #include #include @@ -82,10 +81,10 @@ time_from_string (string t) static boost::posix_time::time_duration duration_from_string (string d) { - locked_stringstream s (d); int N; - string unit; - s >> N >> unit; + char unit_buf[64] = "\0"; + sscanf (d.c_str(), "%d %64s", &N, unit_buf); + string const unit (unit_buf); if (N == 0) { cerr << "Could not understand duration \"" << d << "\"\n"; diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 08a04f35c..4e9d5592d 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -191,9 +191,7 @@ private: void update_state () { - locked_stringstream s; - s << fixed << setprecision(1) << server_log->fps (); - _fps->SetLabel (std_to_wx (s.str())); + _fps->SetLabel (wxString::Format ("%.1f", server_log->fps())); } wxTextCtrl* _text; -- cgit v1.2.3