diff options
author | Michael Fisher <mfisher31@gmail.com> | 2019-11-18 20:46:48 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-17 11:38:46 +0100 |
commit | 91ca5a8fe86294ac2d536c510f777ccfe04ce4b7 (patch) | |
tree | 7d1c5e018c4f7bde3b0e9541db1a5849f81e397e /plugins | |
parent | 517e8657e581b0c0abafe2fd2deb5182939c39e3 (diff) | |
download | lv2-91ca5a8fe86294ac2d536c510f777ccfe04ce4b7.tar.xz |
eg-sampler: Destroy widgets in the correct order
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/eg-sampler.lv2/sampler_ui.c | 25 |
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; |