From ea8327ce5bbe06468a67c168a7fea25ae6af7db2 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 10 Apr 2015 09:48:55 -0700 Subject: [PATCH] libobs: Always free effect if not cached Fix an issue where effects that fail to compile will not properly free their data if they cannot not be parsed or compiled. --- libobs/graphics/effect.c | 2 +- libobs/graphics/effect.h | 1 + libobs/graphics/graphics.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) 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; }