Fix an issue where effects that fail to compile will not properly free their data if they cannot not be parsed or compiled.
@@ -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);
}
@@ -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;
@@ -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;