summaryrefslogtreecommitdiff
path: root/src/wx/video_waveform_plot.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-04-13 21:09:37 +0200
committerCarl Hetherington <cth@carlh.net>2025-04-13 21:09:37 +0200
commitd16267be986c0994f05fc6a3889b83ba53a230b0 (patch)
tree8f416cd12b06f2a334023c891bb78bd0996bb518 /src/wx/video_waveform_plot.cc
parentc325ab5f745c67e6381bcee582bf809018d809e0 (diff)
Don't bind a shared_ptr<PlayerVideo> to ImageChanged (#3013).
Otherwise if the GUI is busy when the emissions build up, each one holds a reference to a potentially large image. This caused enormous memory use when playing a DCP and verifying it at the same time.
Diffstat (limited to 'src/wx/video_waveform_plot.cc')
-rw-r--r--src/wx/video_waveform_plot.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wx/video_waveform_plot.cc b/src/wx/video_waveform_plot.cc
index ebff68096..2827689a7 100644
--- a/src/wx/video_waveform_plot.cc
+++ b/src/wx/video_waveform_plot.cc
@@ -56,12 +56,13 @@ int const VideoWaveformPlot::_x_axis_width = 52;
VideoWaveformPlot::VideoWaveformPlot(wxWindow* parent, weak_ptr<const Film> film, FilmViewer& viewer)
: wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
, _film (film)
+ , _viewer(viewer)
{
#ifndef __WXOSX__
SetDoubleBuffered (true);
#endif
- _viewer_connection = viewer.ImageChanged.connect(boost::bind(&VideoWaveformPlot::set_image, this, _1));
+ _viewer_connection = _viewer.ImageChanged.connect(boost::bind(&VideoWaveformPlot::set_image, this));
Bind (wxEVT_PAINT, boost::bind(&VideoWaveformPlot::paint, this));
Bind (wxEVT_SIZE, boost::bind(&VideoWaveformPlot::sized, this, _1));
@@ -186,7 +187,7 @@ VideoWaveformPlot::create_waveform ()
void
-VideoWaveformPlot::set_image (shared_ptr<PlayerVideo> image)
+VideoWaveformPlot::set_image()
{
if (!_enabled) {
return;
@@ -195,7 +196,7 @@ VideoWaveformPlot::set_image (shared_ptr<PlayerVideo> image)
/* We must copy the PlayerVideo here as we will call ::image() on it, potentially
with a different pixel_format than was used when ::prepare() was called.
*/
- _image = DCPVideo::convert_to_xyz(image->shallow_copy());
+ _image = DCPVideo::convert_to_xyz(_viewer.last_image()->shallow_copy());
_dirty = true;
Refresh ();
}