Added a GTK2/GTK3-compatible cursor unref helper to centralize cleanup logic.

Switched cursor destruction to use the new helper in the widget teardown path.
This commit is contained in:
2026-01-22 23:32:50 -07:00
parent a05c064466
commit 5596c8825b

View File

@@ -150,6 +150,16 @@ static void gtk_xtext_search_fini (xtext_buffer *);
static gboolean gtk_xtext_search_init (xtext_buffer *buf, const gchar *text, gtk_xtext_search_flags flags, GError **perr);
static char * gtk_xtext_get_word (GtkXText * xtext, int x, int y, textentry ** ret_ent, int *ret_off, int *ret_len, GSList **slp);
static inline void
gtk_xtext_cursor_unref (GdkCursor *cursor)
{
#if !HAVE_GTK3
gdk_cursor_unref (cursor);
#else
g_object_unref (cursor);
#endif
}
static inline void
xtext_set_source_color (cairo_t *cr, const XTextColor *color, gdouble alpha)
{
@@ -689,21 +699,13 @@ gtk_xtext_destroy (GtkObject * object)
if (xtext->hand_cursor)
{
#if !HAVE_GTK3
gdk_cursor_unref (xtext->hand_cursor);
#else
g_object_unref (xtext->hand_cursor);
#endif
gtk_xtext_cursor_unref (xtext->hand_cursor);
xtext->hand_cursor = NULL;
}
if (xtext->resize_cursor)
{
#if !HAVE_GTK3
gdk_cursor_unref (xtext->resize_cursor);
#else
g_object_unref (xtext->resize_cursor);
#endif
gtk_xtext_cursor_unref (xtext->resize_cursor);
xtext->resize_cursor = NULL;
}