diff --git a/libobs/graphics/effect.c b/libobs/graphics/effect.c index 215302385..249268930 100644 --- a/libobs/graphics/effect.c +++ b/libobs/graphics/effect.c @@ -30,7 +30,7 @@ void gs_effect_actually_destroy(gs_effect_t *effect) void gs_effect_destroy(gs_effect_t *effect) { if (effect) { - if (!effect->effect_path) + if (!effect->cached) gs_effect_actually_destroy(effect); } } diff --git a/libobs/graphics/effect.h b/libobs/graphics/effect.h index b28638222..8eb54649d 100644 --- a/libobs/graphics/effect.h +++ b/libobs/graphics/effect.h @@ -137,6 +137,7 @@ static inline void effect_technique_free(struct gs_effect_technique *t) struct gs_effect { bool processing; + bool cached; char *effect_path, *effect_dir; DARRAY(struct gs_effect_param) params; diff --git a/libobs/graphics/graphics.c b/libobs/graphics/graphics.c index 9808d46f4..9d8c63e09 100644 --- a/libobs/graphics/graphics.c +++ b/libobs/graphics/graphics.c @@ -732,6 +732,7 @@ gs_effect_t *gs_effect_create(const char *effect_string, const char *filename, pthread_mutex_lock(&thread_graphics->effect_mutex); if (effect->effect_path) { + effect->cached = true; effect->next = thread_graphics->first_effect; thread_graphics->first_effect = effect; }