Skip to content

Commit 7100dc7

Browse files
committed
Adding lock around SetCache method, which causes some crashes. Detected in Sentry: OPENSHOT-1Q
1 parent f544d84 commit 7100dc7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Timeline.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,9 @@ std::vector<Clip*> Timeline::find_intersecting_clips(int64_t requested_frame, in
10961096

10971097
// Set the cache object used by this reader
10981098
void Timeline::SetCache(CacheBase* new_cache) {
1099+
// Get lock (prevent getting frames while this happens)
1100+
const std::lock_guard<std::recursive_mutex> lock(getFrameMutex);
1101+
10991102
// Destroy previous cache (if managed by timeline)
11001103
if (managed_cache && final_cache) {
11011104
delete final_cache;

0 commit comments

Comments
 (0)