aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Fisher <mfisher31@gmail.com>2019-11-18 20:46:48 -0500
committerDavid Robillard <d@drobilla.net>2020-03-17 11:38:46 +0100
commit91ca5a8fe86294ac2d536c510f777ccfe04ce4b7 (patch)
tree7d1c5e018c4f7bde3b0e9541db1a5849f81e397e
parent517e8657e581b0c0abafe2fd2deb5182939c39e3 (diff)
downloadlv2-91ca5a8fe86294ac2d536c510f777ccfe04ce4b7.tar.xz
eg-sampler: Destroy widgets in the correct order
-rw-r--r--plugins/eg-sampler.lv2/sampler_ui.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c
index 0140e24..b5e40db 100644
--- a/plugins/eg-sampler.lv2/sampler_ui.c
+++ b/plugins/eg-sampler.lv2/sampler_ui.c
@@ -214,6 +214,16 @@ on_canvas_expose(GtkWidget* widget, GdkEventExpose* event, gpointer data)
return TRUE;
}
+static void
+destroy_window(SamplerUI* ui)
+{
+ if (ui->window) {
+ gtk_container_remove(GTK_CONTAINER(ui->window), ui->box);
+ gtk_widget_destroy(ui->window);
+ ui->window = NULL;
+ }
+}
+
static gboolean
on_window_closed(GtkWidget* widget, GdkEvent* event, gpointer data)
{
@@ -314,12 +324,17 @@ static void
cleanup(LV2UI_Handle handle)
{
SamplerUI* ui = (SamplerUI*)handle;
- gtk_widget_destroy(ui->box);
- gtk_widget_destroy(ui->play_button);
+
+ if (ui->window) {
+ destroy_window(ui);
+ }
+
gtk_widget_destroy(ui->canvas);
- gtk_widget_destroy(ui->button_box);
+ gtk_widget_destroy(ui->play_button);
gtk_widget_destroy(ui->file_button);
gtk_widget_destroy(ui->request_file_button);
+ gtk_widget_destroy(ui->button_box);
+ gtk_widget_destroy(ui->box);
free(ui);
}
@@ -399,9 +414,7 @@ ui_hide(LV2UI_Handle handle)
SamplerUI* ui = (SamplerUI*)handle;
if (ui->window) {
- gtk_container_remove(GTK_CONTAINER(ui->window), ui->box);
- gtk_widget_destroy(ui->window);
- ui->window = NULL;
+ destroy_window(ui);
}
return 0;