]> git.sesse.net Git - pkanalytics/commitdiff
Fix a crash on exit.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 23 Jul 2023 09:06:56 +0000 (11:06 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 23 Jul 2023 09:06:56 +0000 (11:06 +0200)
video_widget.cpp
video_widget.h

index 0bd910ce29f826e86e62629ad609158ca72e09a1..5d706ac3f55051080dd9b9bfbac97e0fb53b72a6 100644 (file)
@@ -249,6 +249,16 @@ VideoWidget::VideoWidget(QWidget *parent)
        connect(video_window, &VideoWindow::mouse_moved, this, &VideoWidget::mouseMoveEvent);
 }
 
+VideoWidget::~VideoWidget()
+{
+       stop();
+
+       // Qt will delete video_window for us after we're gone,
+       // so make sure its destructor does not try to mess with
+       // our freelist. The actual freelist frames will leak.
+       video_window->set_current_frame(nullptr);
+}
+
 GLuint compile_shader(const string &shader_src, GLenum type)
 {
        GLuint obj = glCreateShader(type);
index 4361d3098c8f3fd2d6414d69ebd868f32a3f2ed6..b97be69e753ed92fb1ffc353dec47cfbe9b402f4 100644 (file)
@@ -26,7 +26,7 @@ class VideoWidget : public QWidget {
 
 public:
        VideoWidget(QWidget *parent);
-       ~VideoWidget() { stop(); }
+       ~VideoWidget();
 
        bool open(const std::string &filename);  // False on error.
        void play();