diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index a66654b364..68b7694092 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -102,13 +102,13 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window m_volume_label = &menubar.add(); m_volume_label->set_fixed_width(30); - auto& volume_slider = menubar.add(); - volume_slider.set_fixed_width(95); - volume_slider.set_min(0); - volume_slider.set_max(150); - volume_slider.set_value(100); + m_volume_slider = &menubar.add(); + m_volume_slider->set_fixed_width(95); + m_volume_slider->set_min(0); + m_volume_slider->set_max(150); + m_volume_slider->set_value(100); - volume_slider.on_change = [&](int value) { + m_volume_slider->on_change = [&](int value) { double volume = m_nonlinear_volume_slider ? (double)(value * value) / (100 * 100) : value / 100.; set_volume(volume); }; diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.h b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.h index e8198f7eca..f73297c113 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.h +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.h @@ -73,6 +73,7 @@ private: RefPtr m_next_button; RefPtr m_playback_progress_slider; RefPtr m_volume_label; + RefPtr m_volume_slider; RefPtr m_timestamp_label; bool m_nonlinear_volume_slider;