summaryrefslogtreecommitdiffstats
path: root/src/instance.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/instance.c')
-rw-r--r--src/instance.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/instance.c b/src/instance.c
index 57cb7e1..fcb7786 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -257,13 +257,18 @@ suil_instance_free(SuilInstance* instance)
}
free(instance->features);
+ // Call wrapper free function to destroy widgets and drop references
+ if (instance->wrapper && instance->wrapper->free) {
+ instance->wrapper->free(instance->wrapper);
+ }
+
+ // Call cleanup to destroy UI (if it still exists at this point)
if (instance->handle) {
instance->descriptor->cleanup(instance->handle);
}
+
+ // Close libraries and free everything
if (instance->wrapper) {
- if (instance->wrapper->free) {
- instance->wrapper->free(instance->wrapper);
- }
dlclose(instance->wrapper->lib);
free(instance->wrapper);
}