Avoid calls to Glib::ustring << operator at all cost.

Glib::operator<<(std::ostream&, Glib::ustring const&) involves
loadlocale which is not thread-safe on OSX.

This fixes various seemingly random crashes on OSX.
This commit is contained in:
Robin Gareus 2015-10-14 22:39:46 +02:00
parent 5eefdf7536
commit 8b80fe04ad
8 changed files with 21 additions and 21 deletions

View File

@ -3480,7 +3480,7 @@ The following file was deleted from %2,\n\
releasing %3 %4bytes of disk space", "\
The following %1 files were deleted from %2,\n\
releasing %3 %4bytes of disk space", removed),
removed, Glib::Markup::escape_text (dead_directory), space_adjusted, bprefix, PROGRAM_NAME));
removed, Glib::Markup::escape_text (dead_directory).c_str(), space_adjusted, bprefix, PROGRAM_NAME));
} else {
txt.set_markup (string_compose (P_("\
The following file was not in use and \n\
@ -3493,7 +3493,7 @@ have been moved to: %2\n\n\
After a restart of %5\n\n\
<span face=\"mono\">Session -> Clean-up -> Flush Wastebasket</span>\n\n\
will release an additional %3 %4bytes of disk space.\n", removed),
removed, Glib::Markup::escape_text (dead_directory), space_adjusted, bprefix, PROGRAM_NAME));
removed, Glib::Markup::escape_text (dead_directory).c_str(), space_adjusted, bprefix, PROGRAM_NAME));
}
dhbox.pack_start (*dimage, true, false, 5);

View File

@ -390,14 +390,14 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
row[_columns.property_toggles_visible] = false;
if (missing_source) {
row[_columns.path] = _("(MISSING) ") + Glib::Markup::escape_text (region->source()->name());
row[_columns.path] = _("(MISSING) ") + std::string(Glib::Markup::escape_text (region->source()->name()));
} else {
boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource>(region->source());
if (fs) {
row[_columns.path] = Glib::Markup::escape_text (fs->path());
row[_columns.path] = Glib::Markup::escape_text (fs->path()).c_str();
} else {
row[_columns.path] = Glib::Markup::escape_text (region->source()->name());
row[_columns.path] = Glib::Markup::escape_text (region->source()->name()).c_str();
}
}
@ -949,9 +949,9 @@ void
EditorRegions::populate_row_name (boost::shared_ptr<Region> region, TreeModel::Row const &row)
{
if (region->n_channels() > 1) {
row[_columns.name] = string_compose("%1 [%2]", Glib::Markup::escape_text (region->name()), region->n_channels());
row[_columns.name] = string_compose("%1 [%2]", Glib::Markup::escape_text (region->name()).c_str(), region->n_channels());
} else {
row[_columns.name] = Glib::Markup::escape_text (region->name());
row[_columns.name] = Glib::Markup::escape_text (region->name()).c_str();
}
}
@ -959,9 +959,9 @@ void
EditorRegions::populate_row_source (boost::shared_ptr<Region> region, TreeModel::Row const &row)
{
if (boost::dynamic_pointer_cast<SilentFileSource>(region->source())) {
row[_columns.path] = _("MISSING ") + Glib::Markup::escape_text (region->source()->name());
row[_columns.path] = _("MISSING ") + std::string(Glib::Markup::escape_text (region->source()->name()));
} else {
row[_columns.path] = Glib::Markup::escape_text (region->source()->name());
row[_columns.path] = Glib::Markup::escape_text (region->source()->name()).c_str();
}
}

View File

@ -68,7 +68,7 @@ MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataT
msg.set_justify (JUSTIFY_LEFT);
msg.set_markup (string_compose (_("%1 cannot find the %2 file\n\n<i>%3</i>\n\nin any of these folders:\n\n\
<tt>%4</tt>\n\n"), PROGRAM_NAME, typestr, Glib::Markup::escape_text(path), Glib::Markup::escape_text (oss.str())));
<tt>%4</tt>\n\n"), PROGRAM_NAME, typestr, Glib::Markup::escape_text(path).c_str(), Glib::Markup::escape_text (oss.str().c_str())));
HBox* hbox = manage (new HBox);
hbox->pack_start (msg, false, true);

View File

@ -1352,7 +1352,7 @@ MonitorSection::update_output_display ()
char * tooltip_cstr;
io_count = _route->n_outputs().n_total();
tooltip << string_compose (_("<b>OUTPUT</b> from %1"), Glib::Markup::escape_text(_route->name()));
tooltip << string_compose (_("<b>OUTPUT</b> from %1"), Glib::Markup::escape_text(_route->name().c_str()));
for (io_index = 0; io_index < io_count; ++io_index) {
@ -1378,12 +1378,12 @@ MonitorSection::update_output_display ()
}
if (io_connection_count == 0) {
tooltip << endl << Glib::Markup::escape_text(port->name().substr(port->name().find("/") + 1))
tooltip << endl << Glib::Markup::escape_text(port->name().substr(port->name().find("/") + 1)).c_str()
<< " -> "
<< Glib::Markup::escape_text( pn.empty() ? connection_name : pn );
<< Glib::Markup::escape_text( pn.empty() ? connection_name : pn ).c_str();
} else {
tooltip << ", "
<< Glib::Markup::escape_text( pn.empty() ? connection_name : pn );
<< Glib::Markup::escape_text( pn.empty() ? connection_name : pn ).c_str();
}
if (connection_name.find("ardour:") == 0) {

View File

@ -1041,7 +1041,7 @@ PortMatrix::update_tab_highlighting ()
label->set_text ((*j)->name);
} else if (c.length() && c[0] != '<' && has_connection) {
/* this label is not marked up with <b> but should be */
label->set_markup (string_compose ("<b>%1</b>", Glib::Markup::escape_text ((*j)->name)));
label->set_markup (string_compose ("<b>%1</b>", Glib::Markup::escape_text ((*j)->name).c_str()));
}
++p;

View File

@ -1790,8 +1790,8 @@ RouteTimeAxisView::update_playlist_tip ()
set_tooltip (
playlist_button,
string_compose(_("Take: %1.%2"),
Glib::Markup::escape_text(rg->name()),
Glib::Markup::escape_text(take_name))
Glib::Markup::escape_text(rg->name()).c_str(),
Glib::Markup::escape_text(take_name).c_str())
);
return;
@ -1799,7 +1799,7 @@ RouteTimeAxisView::update_playlist_tip ()
}
/* set the playlist button tooltip to the playlist name */
set_tooltip (playlist_button, _("Playlist") + std::string(": ") + Glib::Markup::escape_text(track()->playlist()->name()));
set_tooltip (playlist_button, _("Playlist") + std::string(": ") + Glib::Markup::escape_text(track()->playlist()->name()).c_str());
}

View File

@ -700,7 +700,7 @@ SessionDialog::redisplay_recent_sessions ()
g_stat (s.c_str(), &gsb);
row[recent_session_columns.fullpath] = dirname; /* just the dir, but this works too */
row[recent_session_columns.tip] = Glib::Markup::escape_text (dirname);
row[recent_session_columns.tip] = Glib::Markup::escape_text (dirname).c_str();
row[recent_session_columns.time_modified] = gsb.st_mtime;
if (Session::get_info_from_path (s, sr, sf) == 0) {
@ -739,7 +739,7 @@ SessionDialog::redisplay_recent_sessions ()
child_row[recent_session_columns.visible_name] = *i2;
child_row[recent_session_columns.fullpath] = s;
child_row[recent_session_columns.tip] = Glib::Markup::escape_text (dirname);
child_row[recent_session_columns.tip] = Glib::Markup::escape_text (dirname).c_str();
g_stat (s.c_str(), &gsb);
child_row[recent_session_columns.time_modified] = gsb.st_mtime;

View File

@ -336,7 +336,7 @@ SoundFileBox::setup_labels (const string& filename)
return false;
}
preview_label.set_markup (string_compose ("<b>%1</b>", Glib::Markup::escape_text (Glib::path_get_basename (filename))));
preview_label.set_markup (string_compose ("<b>%1</b>", Glib::Markup::escape_text (Glib::path_get_basename (filename)).c_str()));
std::string n = sf_info.format_name;
if (n.substr (0, 8) == X_("Format: ")) {
n = n.substr (8);