From 8b80fe04ad0cc4dc5429f65e21ed636ed87dc634 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 14 Oct 2015 22:39:46 +0200 Subject: 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. --- gtk2_ardour/ardour_ui.cc | 4 ++-- gtk2_ardour/editor_regions.cc | 14 +++++++------- gtk2_ardour/missing_file_dialog.cc | 2 +- gtk2_ardour/monitor_section.cc | 8 ++++---- gtk2_ardour/port_matrix.cc | 2 +- gtk2_ardour/route_time_axis.cc | 6 +++--- gtk2_ardour/session_dialog.cc | 4 ++-- gtk2_ardour/sfdb_ui.cc | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index b55c50506e..e418e3c62f 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -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\ Session -> Clean-up -> Flush Wastebasket\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); diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index 31e7bf1309..12503e1ab7 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -390,14 +390,14 @@ EditorRegions::add_region (boost::shared_ptr 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 fs = boost::dynamic_pointer_cast(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, 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, TreeModel::Row const &row) { if (boost::dynamic_pointer_cast(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(); } } diff --git a/gtk2_ardour/missing_file_dialog.cc b/gtk2_ardour/missing_file_dialog.cc index 8f171947b4..9bbb564592 100644 --- a/gtk2_ardour/missing_file_dialog.cc +++ b/gtk2_ardour/missing_file_dialog.cc @@ -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%3\n\nin any of these folders:\n\n\ -%4\n\n"), PROGRAM_NAME, typestr, Glib::Markup::escape_text(path), Glib::Markup::escape_text (oss.str()))); +%4\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); diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index aa5a85ac94..6ff9de091e 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -1352,7 +1352,7 @@ MonitorSection::update_output_display () char * tooltip_cstr; io_count = _route->n_outputs().n_total(); - tooltip << string_compose (_("OUTPUT from %1"), Glib::Markup::escape_text(_route->name())); + tooltip << string_compose (_("OUTPUT 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) { diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc index b29e117f1f..027778ca05 100644 --- a/gtk2_ardour/port_matrix.cc +++ b/gtk2_ardour/port_matrix.cc @@ -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 but should be */ - label->set_markup (string_compose ("%1", Glib::Markup::escape_text ((*j)->name))); + label->set_markup (string_compose ("%1", Glib::Markup::escape_text ((*j)->name).c_str())); } ++p; diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 5a1585289c..92ae7e0a0f 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -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()); } diff --git a/gtk2_ardour/session_dialog.cc b/gtk2_ardour/session_dialog.cc index a6175d5031..a7a0f0be26 100644 --- a/gtk2_ardour/session_dialog.cc +++ b/gtk2_ardour/session_dialog.cc @@ -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; diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index c2bd388d6c..231498cda2 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -336,7 +336,7 @@ SoundFileBox::setup_labels (const string& filename) return false; } - preview_label.set_markup (string_compose ("%1", Glib::Markup::escape_text (Glib::path_get_basename (filename)))); + preview_label.set_markup (string_compose ("%1", 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); -- cgit v1.2.3