mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
Merge branch 'dboles/issue5922-DropTarget-reject-enter-critical' into 'main'
DropTarget: Fix critical if `reject()` drop before `::enter` Closes #5922 See merge request GNOME/gtk!6152
This commit is contained in:
commit
526771751f
@ -507,13 +507,19 @@ gtk_drop_target_handle_crossing (GtkEventController *controller,
|
||||
graphene_point_init (&self->coords, x, y);
|
||||
gtk_drop_target_start_drop (self, crossing->drop);
|
||||
|
||||
g_signal_emit (self, signals[ENTER], 0, x, y, &preferred);
|
||||
if (!gdk_drag_action_is_unique (preferred))
|
||||
{
|
||||
g_critical ("Handler for GtkDropTarget::enter on %s %p did not return a unique preferred action",
|
||||
G_OBJECT_TYPE_NAME (widget), widget);
|
||||
preferred = make_action_unique (preferred);
|
||||
}
|
||||
/* start_drop ends w/ thaw_notify, where handler may reject, so recheck */
|
||||
if (self->drop != NULL)
|
||||
g_signal_emit (self, signals[ENTER], 0, x, y, &preferred);
|
||||
else
|
||||
preferred = 0;
|
||||
|
||||
if (!gdk_drag_action_is_unique (preferred))
|
||||
{
|
||||
g_critical ("Handler for GtkDropTarget::enter on %s %p did not return a unique preferred action",
|
||||
G_OBJECT_TYPE_NAME (widget), widget);
|
||||
preferred = make_action_unique (preferred);
|
||||
}
|
||||
|
||||
if (preferred &&
|
||||
gtk_drop_status (self->drop, self->actions, preferred))
|
||||
{
|
||||
@ -533,6 +539,7 @@ gtk_drop_target_handle_crossing (GtkEventController *controller,
|
||||
g_signal_emit (self, signals[LEAVE], 0);
|
||||
if (!self->dropping)
|
||||
gtk_drop_target_end_drop (self);
|
||||
|
||||
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_DROP_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user