fix: dangling OpenGL context crash and uninitialized audio frame size

- OpenGLRenderer: hold the viewer-owned QOpenGLContext in a QPointer so
  DestroyInternal() safely skips it when the context has already been
  destroyed by Qt's shared-context lifecycle. Fixes a SIGSEGV when the
  full gtest suite ran MainWindow.ConstructsOffscreenWithPanelsAndMenus
  after earlier viewer tests.
- PreviewAudioDevice: add SetParams() deriving bytes_per_frame from the
  audio format (bytes per sample * channel count) instead of staying 0.
This commit is contained in:
2026-07-19 13:58:06 +08:00
parent 842bc7632b
commit b0aa683499
4 changed files with 28 additions and 6 deletions
+7
View File
@@ -22,6 +22,8 @@
#ifndef PREVIEWAUDIODEVICE_H
#define PREVIEWAUDIODEVICE_H
#include <olive/core/render/audioparams.h>
#include "previewautocacher.h"
namespace olive
@@ -42,6 +44,11 @@ public:
virtual qint64 writeData(const char *data, qint64 length) override;
// Derives the frame size from the audio format (bytes per sample per
// channel * channel count). Until params are set, bytes_per_frame()
// reports 0, i.e. "unknown".
void SetParams(const core::AudioParams &params);
int bytes_per_frame() const
{
return bytes_per_frame_;