diff --git a/src/ivoc/graph.cpp b/src/ivoc/graph.cpp index b073a0f350..140b375337 100644 --- a/src/ivoc/graph.cpp +++ b/src/ivoc/graph.cpp @@ -2429,7 +2429,7 @@ void Graph::choose_sym() { neuron::container::data_handle pd_handle{pd}; if (sc_->selected_vector_count()) { - Sprintf(buf, "%s", sc_->selected()->string()); + Sprintf(buf, "%s", sc_->selected().c_str()); GraphVector* gv = new GraphVector(buf); gv->color(color()); gv->brush(brush()); @@ -2444,10 +2444,10 @@ void Graph::choose_sym() { flush(); break; } else if (pd) { - add_var(sc_->selected()->string(), color(), brush(), 1, 2); + add_var(sc_->selected().c_str(), color(), brush(), 1, 2); break; } else { - CopyString s(*sc_->selected()); + CopyString s(sc_->selected().c_str()); // above required due to bug in mswindows version in which // sc_->selected seems volatile under some kinds of hoc // executions. @@ -2475,12 +2475,12 @@ void Graph::family_label_chooser() { } while (fsc_->post_for_aligned(XYView::current_pick_view()->canvas()->window(), .5, 1.)) { char buf[256]; - Sprintf(buf, "hoc_ac_ = %s\n", fsc_->selected()->string()); + Sprintf(buf, "hoc_ac_ = %s\n", fsc_->selected().c_str()); if (oc.run(buf) == 0) { - family(fsc_->selected()->string()); + family(fsc_->selected().c_str()); break; } - hoc_warning(sc_->selected()->string(), "is not an expression."); + hoc_warning(sc_->selected().c_str(), "is not an expression."); } } diff --git a/src/ivoc/symchoos.cpp b/src/ivoc/symchoos.cpp index f0a1e9abd7..ea9048bf58 100644 --- a/src/ivoc/symchoos.cpp +++ b/src/ivoc/symchoos.cpp @@ -200,7 +200,7 @@ static double text(void* v) { #if HAVE_IV IFGUI SymChooser* sc = (SymChooser*) v; - hoc_assign_str(hoc_pgargstr(1), sc->selected()->string()); + hoc_assign_str(hoc_pgargstr(1), sc->selected().c_str()); ENDGUI return 0.; #else @@ -247,10 +247,8 @@ SymChooser::~SymChooser() { delete impl_; } -const String* SymChooser::selected() const { - static String s; - s = impl_->selected_.c_str(); - return &s; +const std::string& SymChooser::selected() const { + return impl_->selected_; } double* SymChooser::selected_var() { diff --git a/src/ivoc/symchoos.h b/src/ivoc/symchoos.h index 2d94449d09..dc465fe355 100644 --- a/src/ivoc/symchoos.h +++ b/src/ivoc/symchoos.h @@ -55,7 +55,7 @@ class SymChooser: public Dialog { SymChooser(SymDirectory*, WidgetKit*, Style*, SymChooserAction* = NULL, int nbrowser = 3); virtual ~SymChooser(); - virtual const String* selected() const; + virtual const std::string& selected() const; virtual double* selected_var(); virtual int selected_vector_count(); virtual void reread(); diff --git a/src/nrniv/shapeplt.cpp b/src/nrniv/shapeplt.cpp index 27df1aa624..994cdddb11 100644 --- a/src/nrniv/shapeplt.cpp +++ b/src/nrniv/shapeplt.cpp @@ -768,7 +768,7 @@ void ShapePlotImpl::select_variable() { sc->ref(); while (sc->post_for(XYView::current_pick_view()->canvas()->window())) { Symbol* s; - s = hoc_table_lookup(sc->selected()->string(), hoc_built_in_symlist); + s = hoc_table_lookup(sc->selected().c_str(), hoc_built_in_symlist); if (s) { sp_->variable(s); break;