fix: teardown UAF in Track block cache and headless test/render environment

- Track: new InputDisconnectedEvent trims blocks_/block_array_indexes_
  when a block edge is removed outside the Track's own operations
  (block deletion, undo commands detaching a whole track). Previously
  blocks_ kept dangling pointers and Project teardown crashed in
  track_length() (ASan heap-use-after-free in oakengine_timeline_edit /
  oakengine_sync). The persistent array map is intentionally not
  rewritten so undo of remove_track can re-attach the clips; replace_block
  guards the handler with ignore_block_disconnect_
- filefunctions: honor OAK_CONFIG_DIR to redirect the configuration
  root; QStandardPaths ignores XDG_* on macOS, so the engine tests read
  the real user config (a stale 0.1.x file) and failed frame-rate
  assertions. All engine tests now set OAK_CONFIG_DIR to their tmpdir
- init test: chdir to the fixture directory before loading
  project_with_footage.ove so the engine's moved-project footage
  relocation does not rewrite the stored relative filename
- renderworkerpool: do not let the render worker inherit
  QT_QPA_PLATFORM=offscreen from a headless host process; the worker
  needs a real platform GL context and exited immediately otherwise,
  failing oak_cli_transcode
This commit is contained in:
2026-08-01 20:35:13 +08:00
parent 8399d04b44
commit 30853cbcfd
18 changed files with 84 additions and 0 deletions
+11
View File
@@ -1141,6 +1141,17 @@ std::unique_ptr<RenderWorkerPool::PooledWorker> RenderWorkerPool::acquire_worker
process->setProgram(worker_program_path());
process->setArguments({ QStringLiteral("--backend"), gpu_backend_ });
// The engine defaults QT_QPA_PLATFORM to "offscreen" for headless hosts
// (cli/tests), but the worker needs a real platform GL context. Don't let
// it inherit the offscreen default from this process.
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
if (qEnvironmentVariable("QT_QPA_PLATFORM") == "offscreen") {
env.remove(QStringLiteral("QT_QPA_PLATFORM"));
process->setProcessEnvironment(env);
}
}
const QString worker_stderr_path =
QDir(QDir::tempPath())
.filePath(QStringLiteral("oak-render-worker-%1-%2.stderr.log")