[vim/vim] GTK2 segfault since patch 9.1.1583 - incorrect g_object_unref on icon_theme singleton (Issue #18997)

1 view
Skip to first unread message

noamhalevy-wq

unread,
9:31 AM (12 hours ago) 9:31 AM
to vim/vim, Subscribed
noamhalevy-wq created an issue (vim/vim#18997)

Problem

Since patch 9.1.1583, gvim with GTK2 crashes with SEGV on startup.

Cause

In src/gui_gtk_x11.c, the function mainwin_realize() calls:
icon_theme = gtk_icon_theme_get_default();and later:
g_object_unref(icon_theme);However, gtk_icon_theme_get_default() returns a singleton that should NOT be unreferenced. From GTK documentation:

"Gets the icon theme for the default screen. [...] This icon theme is associated with the screen and can be used as long as the screen is open."

This causes a use-after-free crash in GTK2.

Patch that introduced the bug

Commit 9d5bb58 (patch 9.1.1583: gvim window lost its icons)

Fix

Remove the g_object_unref(icon_theme); line at the end of the icon handling block.

System info

  • Rocky Linux 8
  • GTK2 version: 2.24.32
  • Vim version: 9.1.2006 (and earlier back to 9.1.1583)

Workaround

Comment out the offending line:
// g_object_unref(icon_theme); // Do not unref - singleton from gtk_icon_theme_get_default()


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18997@github.com>

noamhalevy-wq

unread,
9:32 AM (12 hours ago) 9:32 AM
to vim/vim, Subscribed
noamhalevy-wq left a comment (vim/vim#18997)

All the above was done by cursor. I can verify that the fix works.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18997/3682326358@github.com>

Christian Brabandt

unread,
2:06 PM (7 hours ago) 2:06 PM
to vim/vim, Subscribed

Closed #18997 as completed via bb10f71.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/18997/issue_event/21711192393@github.com>

Christian Brabandt

unread,
2:06 PM (7 hours ago) 2:06 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18997)

thanks, should be fixed now with v9.1.2011


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18997/3683727309@github.com>

Reply all
Reply to author
Forward
0 new messages