From 10196a6c3c37403a40ec5082894273a7c586eccd Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 16 Apr 2025 02:48:12 +0200 Subject: [PATCH] Qt: use image_change_callback function to ensure the member is valid --- rpcs3/rpcs3qt/qt_video_source.cpp | 8 ++++---- rpcs3/rpcs3qt/qt_video_source.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rpcs3/rpcs3qt/qt_video_source.cpp b/rpcs3/rpcs3qt/qt_video_source.cpp index c56fb35bc7..107e5ef850 100644 --- a/rpcs3/rpcs3qt/qt_video_source.cpp +++ b/rpcs3/rpcs3qt/qt_video_source.cpp @@ -34,11 +34,11 @@ void qt_video_source::set_active(bool active) } } -void qt_video_source::image_change_callback() const +void qt_video_source::image_change_callback(const QVideoFrame& frame) const { if (m_image_change_callback) { - m_image_change_callback({}); + m_image_change_callback(frame); } } @@ -76,7 +76,7 @@ void qt_video_source::init_movie() QObject::connect(m_movie.get(), &QMovie::frameChanged, m_movie.get(), [this](int) { - m_image_change_callback({}); + image_change_callback(); m_has_new = true; }); return; @@ -105,7 +105,7 @@ void qt_video_source::init_movie() m_video_sink = std::make_unique(); QObject::connect(m_video_sink.get(), &QVideoSink::videoFrameChanged, m_video_sink.get(), [this](const QVideoFrame& frame) { - m_image_change_callback(frame); + image_change_callback(frame); m_has_new = true; }); diff --git a/rpcs3/rpcs3qt/qt_video_source.h b/rpcs3/rpcs3qt/qt_video_source.h index 37fe5fa280..a2710eea33 100644 --- a/rpcs3/rpcs3qt/qt_video_source.h +++ b/rpcs3/rpcs3qt/qt_video_source.h @@ -31,7 +31,7 @@ public: QPixmap get_movie_image(const QVideoFrame& frame) const; - void image_change_callback() const; + void image_change_callback(const QVideoFrame& frame = {}) const; void set_image_change_callback(const std::function& func); protected: