mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
tooltip: Avoid criticals
It is possible that the target widget is already unparented at the time that we call the tooltips handle_event function. Quietly return in that case, no need to emit a critical.
This commit is contained in:
parent
061f257e83
commit
af162b70c5
@ -919,18 +919,21 @@ _gtk_tooltip_handle_event (GtkWidget *target,
|
|||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
double x, y;
|
double x, y;
|
||||||
double nx, ny;
|
double nx, ny;
|
||||||
GtkWidget *native;
|
GtkNative *native;
|
||||||
|
|
||||||
if (!tooltips_enabled (event))
|
if (!tooltips_enabled (event))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
native = gtk_widget_get_native (target);
|
||||||
|
if (!native)
|
||||||
|
return;
|
||||||
|
|
||||||
event_type = gdk_event_get_event_type (event);
|
event_type = gdk_event_get_event_type (event);
|
||||||
surface = gdk_event_get_surface (event);
|
surface = gdk_event_get_surface (event);
|
||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
native = GTK_WIDGET (gtk_widget_get_native (target));
|
|
||||||
|
|
||||||
gtk_native_get_surface_transform (GTK_NATIVE (native), &nx, &ny);
|
gtk_native_get_surface_transform (native, &nx, &ny);
|
||||||
gtk_widget_translate_coordinates (native, target, x - nx, y - ny, &x, &y);
|
gtk_widget_translate_coordinates (GTK_WIDGET (native), target, x - nx, y - ny, &x, &y);
|
||||||
gtk_tooltip_handle_event_internal (event_type, surface, target, x, y);
|
gtk_tooltip_handle_event_internal (event_type, surface, target, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user