summaryrefslogtreecommitdiff
path: root/src/wx/film_viewer.h
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/film_viewer.h
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/film_viewer.h')
-rw-r--r--src/wx/film_viewer.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 8f0cad545..c8aade6c0 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -155,7 +155,10 @@ public:
Frame average_latency() const;
- boost::signals2::signal<void (std::shared_ptr<PlayerVideo>)> ImageChanged;
+ /** The image we are viewing changed: call last_image() to get the image */
+ boost::signals2::signal<void ()> ImageChanged;
+ std::shared_ptr<const PlayerVideo> last_image() const;
+
boost::signals2::signal<void ()> Started;
boost::signals2::signal<void ()> Stopped;
/** While playing back we reached the end of the film (emitted from GUI thread) */
@@ -222,5 +225,10 @@ private:
boost::optional<dcpomatic::Rect<float>> _crop_guess;
+ /** Keep track of the image that we were talking about with the last
+ * emission of ImageChanged.
+ */
+ std::shared_ptr<const PlayerVideo> _last_image;
+
boost::signals2::scoped_connection _config_changed_connection;
};