gs-effect: Also override finalizer for the stored ptr

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-12-16 23:07:49 +01:00
parent e7b46063aa
commit 01f23e17fe

View file

@ -66,7 +66,7 @@ gs::effect::effect(std::string code, std::string name)
: std::runtime_error("Unknown error during effect compile."); : std::runtime_error("Unknown error during effect compile.");
} }
reset(effect); reset(effect, [](gs_effect_t* ptr) { gs_effect_destroy(ptr); });
} }
gs::effect::effect(std::filesystem::path file) : effect(load_file_as_code(file), file.string()) {} gs::effect::effect(std::filesystem::path file) : effect(load_file_as_code(file), file.string()) {}
@ -74,7 +74,7 @@ gs::effect::effect(std::filesystem::path file) : effect(load_file_as_code(file),
gs::effect::~effect() gs::effect::~effect()
{ {
auto gctx = gs::context(); auto gctx = gs::context();
gs_effect_destroy(get()); reset();
} }
size_t gs::effect::count_techniques() size_t gs::effect::count_techniques()