Manage OptionEditor labels

Because those Widgets are added to managed frames (for search highlight)
the labels inside also need to be managed and not destroyed with the
Option (which happens first).

This fixes various GTK warnings at exit
```
gtk_widget_unparent: assertion 'GTK_IS_WIDGET (widget)' failed
```
This commit is contained in:
Robin Gareus 2023-05-31 21:32:54 +02:00
parent c084f74fda
commit 6016c9624e
3 changed files with 13 additions and 16 deletions

View File

@ -442,12 +442,11 @@ HSliderOption::HSliderOption (
, _set (s)
, _adj (lower, lower, upper, step_increment, page_increment, 0)
, _hscale (_adj)
, _label (n + ":")
, _mult (mult)
, _log (logarithmic)
{
_label.set_alignment (0, 0.5);
_label.set_name ("OptionsLabel");
_label = manage (left_aligned_label (n + ":"));
_label->set_name ("OptionsLabel");
_adj.set_value (_get());
_adj.signal_value_changed().connect (sigc::mem_fun (*this, &HSliderOption::changed));
_hscale.set_update_policy (Gtk::UPDATE_DISCONTINUOUS);
@ -483,7 +482,7 @@ HSliderOption::changed ()
void
HSliderOption::add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, &_label, &_hscale);
add_widgets_to_page (p, _label, &_hscale);
}
void
@ -611,9 +610,8 @@ FaderOption::FaderOption (string const & i, string const & n, sigc::slot<gain_t>
{
_db_slider = manage (new ArdourWidgets::HSliderController (&_db_adjustment, std::shared_ptr<PBD::Controllable>(), 220, 18));
_label.set_text (n + ":");
_label.set_alignment (0, 0.5);
_label.set_name (X_("OptionsLabel"));
_label = manage (left_aligned_label (n + ":"));
_label->set_name (X_("OptionsLabel"));
_fader_centering_box.pack_start (*_db_slider, true, false);
@ -677,7 +675,7 @@ FaderOption::on_key_press (GdkEventKey* ev)
void
FaderOption::add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, &_label, &_box);
add_widgets_to_page (p, _label, &_box);
}
/*--------------------------*/
@ -688,9 +686,8 @@ ClockOption::ClockOption (string const & i, string const & n, sigc::slot<std::st
, _get (g)
, _set (s)
{
_label.set_text (n + ":");
_label.set_alignment (0, 0.5);
_label.set_name (X_("OptionsLabel"));
_label = manage (left_aligned_label (n + ":"));
_label->set_name (X_("OptionsLabel"));
_clock.ValueChanged.connect (sigc::mem_fun (*this, &ClockOption::save_clock_time));
}
@ -720,7 +717,7 @@ ClockOption::save_clock_time ()
void
ClockOption::add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, &_label, &_clock);
add_widgets_to_page (p, _label, &_clock);
}
void

View File

@ -436,7 +436,7 @@ protected:
sigc::slot<bool, float> _set;
Gtk::Adjustment _adj;
Gtk::HScale _hscale;
Gtk::Label _label;
Gtk::Label* _label;
double _mult;
bool _log;
};
@ -611,7 +611,7 @@ private:
Gtk::Adjustment _db_adjustment;
ArdourWidgets::HSliderController* _db_slider;
Gtk::Entry _db_display;
Gtk::Label _label;
Gtk::Label* _label;
Gtk::HBox _box;
Gtk::VBox _fader_centering_box;
sigc::slot<ARDOUR::gain_t> _get;
@ -646,7 +646,7 @@ public:
private:
void save_clock_time ();
Gtk::Label _label;
Gtk::Label* _label;
AudioClock _clock;
sigc::slot<std::string> _get;
sigc::slot<bool, std::string> _set;

View File

@ -1151,7 +1151,7 @@ public:
sigc::mem_fun (*c, &RCConfiguration::set_plugin_scan_timeout),
1, 900, 50, 50)
{
_label.set_alignment (1.0, 0.5); // match buttons below
_label->set_alignment (1.0, 0.5); // match buttons below
_hscale.set_digits (0);
_hscale.set_draw_value(false);
_hscale.add_mark ( 10, Gtk::POS_TOP, _("1 sec"));