summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-11 22:33:28 +0000
committerDavid Robillard <d@drobilla.net>2012-05-11 22:33:28 +0000
commit882b74cf79088a8368842cc0cd1b672114ff5ffa (patch)
treed1cffdad8cae076ff8ed0443205078eb17c2154a /src
parent5ca0af64c398072ed9b595e63dc9a54e26da764c (diff)
downloadsuil-882b74cf79088a8368842cc0cd1b672114ff5ffa.tar.gz
suil-882b74cf79088a8368842cc0cd1b672114ff5ffa.tar.bz2
suil-882b74cf79088a8368842cc0cd1b672114ff5ffa.zip
Fix suil_instance_free to avoid a double free when the wrapper has already destructed.
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@4359 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/instance.c11
-rw-r--r--src/x11_in_gtk2.c1
2 files changed, 8 insertions, 4 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);
}
diff --git a/src/x11_in_gtk2.c b/src/x11_in_gtk2.c
index e7b88ed..14b0ea2 100644
--- a/src/x11_in_gtk2.c
+++ b/src/x11_in_gtk2.c
@@ -129,7 +129,6 @@ wrapper_free(SuilWrapper* wrapper)
}
}
-
SUIL_API
SuilWrapper*
suil_wrapper_new(SuilHost* host,