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.
This commit is contained in:
jp9000
2015-04-10 09:48:55 -07:00
parent 2054161717
commit ea8327ce5b
3 changed files with 3 additions and 1 deletions

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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;
}