summaryrefslogtreecommitdiffstats
path: root/src/instance.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-24 22:06:24 +0000
committerDavid Robillard <d@drobilla.net>2012-04-24 22:06:24 +0000
commit3723d115a6f4d30f652957d131c2a6ea56ad1dd0 (patch)
tree53839c92e3d8f4530ccc16959cdd6a6e820bb78d /src/instance.c
parentd8df0d21ab8f2d28c8b0e32670594fa079425a1d (diff)
downloadsuil-3723d115a6f4d30f652957d131c2a6ea56ad1dd0.tar.gz
suil-3723d115a6f4d30f652957d131c2a6ea56ad1dd0.tar.bz2
suil-3723d115a6f4d30f652957d131c2a6ea56ad1dd0.zip
Fix crashes when wrapper widget is destroyed by toolkit before suil cleanup
function is called. git-svn-id: http://svn.drobilla.net/lad/trunk/suil@4264 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/instance.c')
-rw-r--r--src/instance.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/instance.c b/src/instance.c
index f6824e8..57cb7e1 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -257,13 +257,16 @@ suil_instance_free(SuilInstance* instance)
}
free(instance->features);
- if (instance->wrapper) {
- instance->wrapper->free(instance->wrapper);
- dlclose(instance->wrapper->lib);
- }
if (instance->handle) {
instance->descriptor->cleanup(instance->handle);
}
+ if (instance->wrapper) {
+ if (instance->wrapper->free) {
+ instance->wrapper->free(instance->wrapper);
+ }
+ dlclose(instance->wrapper->lib);
+ free(instance->wrapper);
+ }
dlclose(instance->lib_handle);
free(instance);
}