Skip to content

Commit 6771495

Browse files
gtkui: fix regression causing crash when editing plugin settings (fixes #3212)
1 parent cfd6ab2 commit 6771495

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

plugins/gtkui/pluginconf.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ prop_changed (GtkWidget *widget, gpointer user_data) {
239239
gtkui_script_datamodel_t *model = user_data;
240240

241241
if (model->any_property_did_change != NULL) {
242-
model->any_property_did_change(model);
242+
model->any_property_did_change(model->context);
243243
}
244244

245245
if (model->updates_immediately) {
@@ -639,6 +639,13 @@ _any_property_did_change(void *context) {
639639
make_dialog_conf->prop_changed (make_dialog_conf);
640640
}
641641

642+
static gtkui_script_datamodel_t _model = {
643+
.context = NULL,
644+
.updates_immediately = TRUE, // Update on Apply button
645+
.get_param = _get_param,
646+
.set_param = _set_param,
647+
};
648+
642649
void
643650
gtkui_make_dialog (ddb_pluginprefs_dialog_t *make_dialog_conf) {
644651
ddb_dialog_t *conf = &make_dialog_conf->dialog_conf;
@@ -647,22 +654,16 @@ gtkui_make_dialog (ddb_pluginprefs_dialog_t *make_dialog_conf) {
647654

648655
// This needs to be set on an object that is tied to the lifetime of the plugin preferences container
649656
make_dialog_conf = (ddb_pluginprefs_dialog_t *)g_memdup (make_dialog_conf, sizeof (ddb_pluginprefs_dialog_t));
650-
g_object_set_data_full (G_OBJECT (containervbox), "dialog_conf_struct", make_dialog_conf, g_free);
651-
652-
gtkui_script_datamodel_t model = {
653-
.context = make_dialog_conf,
654-
.updates_immediately = FALSE, // Update on Apply button
655-
.get_param = _get_param,
656-
.set_param = _set_param,
657-
};
657+
_model.context = make_dialog_conf;
658658

659-
GtkWidget *content = gtkui_create_ui_from_script(conf->layout, &model, make_dialog_conf->dialog_conf.title);
659+
_model.any_property_did_change = NULL;
660+
GtkWidget *content = gtkui_create_ui_from_script(conf->layout, &_model, make_dialog_conf->dialog_conf.title);
660661

661662
gtk_widget_show(content);
662663
gtk_box_pack_start(GTK_BOX(containervbox), content, TRUE, FALSE, 0);
663664

664665
// Now that all signal handlers are installed, start reacting to changes
665-
model.any_property_did_change = _any_property_did_change;
666+
_model.any_property_did_change = _any_property_did_change;
666667
}
667668

668669
int

0 commit comments

Comments
 (0)