Issue #11999: GFig, Lava and Stain assert.

After commit #a7bc5f07, these plug-ins assert in local_grad_data_refresh().
A comment is clearly stating that the widget must be allocated, so make
sure that the callback is only connected at allocation.
This commit is contained in:
Jehan 2024-09-05 22:20:48 +02:00
parent 753980e514
commit 5ad829c1dc
1 changed files with 7 additions and 4 deletions

View File

@ -126,10 +126,6 @@ gimp_gradient_chooser_init (GimpGradientChooser *self)
G_CALLBACK (gimp_gradient_select_preview_draw_handler),
self);
g_signal_connect (self, "resource-set",
G_CALLBACK (gimp_gradient_select_model_change_handler),
self);
gtk_widget_show_all (GTK_WIDGET (self));
gimp_resource_chooser_set_drag_target (GIMP_RESOURCE_CHOOSER (self),
@ -248,6 +244,13 @@ gimp_gradient_select_preview_size_allocate (GtkWidget *widget,
{
/* Width needed to draw preview. */
local_grad_data_set_allocation_width (self, allocation->width);
g_signal_handlers_disconnect_by_func (self,
G_CALLBACK (gimp_gradient_select_model_change_handler),
self);
g_signal_connect (self, "resource-set",
G_CALLBACK (gimp_gradient_select_model_change_handler),
self);
}
/* Draw array of samples.