Mint 22.3: xapp-sn-watcher segfaults on the second right-click of a tray icon (c445c22 not on 3.2-maintenance)

オープン
#221 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c, linux

調査の方向性

Start with xapp-status-icon.c, where synthesize_event() creates the dummy rect window and the popup event takes it without a ref (around lines 367 and 383), then compare with the fix in commit c445c22 on master. The backport needs that change applied on the 3.2-maintenance branch, and the crash should no longer appear in a repeated right-click loop on a tray icon. Reproducing it needs an AppIndicator tray icon and a display where the watcher can be run under gdb.

索引モデルが issue の本文から書いたものです。

説明

Distribution

Linux Mint 22.3, Cinnamon 6.6

Package version

libxapp1 3.2.4+mint22.3 (libgtk-3-0t64 3.24.41-4ubuntu1.3)

Graphics hardware in use

No response

Frequency

Only occasionally

Bug description

xapp-sn-watcher crashed when I right-clicked the Whatsie tray icon, and all tray icons reloaded once cinnamon-session restarted it. As far as I can tell this is the use-after-free that c445c22 fixes on master, where it showed up as "GdkWindow unexpectedly destroyed" warnings. The dummy rect window from synthesize_event() goes into the popup event without a ref, so on the second popup of the same menu the old dummy is freed while its XID is still in GDK's table, and the DestroyNotify lookup can hand back freed memory.

Crashing thread:

#0 gdk_event_source_get_filter_window () at gdk/x11/gdkeventsource.c:123
#1 gdk_event_source_translate_event () at gdk/x11/gdkeventsource.c:189
#2 _gdk_x11_display_queue_events () at gdk/x11/gdkeventsource.c:341
#3 gdk_display_get_event () at gdk/gdkdisplay.c:442
#4 gdk_event_source_dispatch () at gdk/x11/gdkeventsource.c:354
#5 g_main_dispatch () at glib/gmain.c:3344
   ...
#8 g_application_run ()
#9 main ()

The event is a DestroyNotify for 0x2c002a5. In the core that XID still maps to a freed 416-byte GdkWindow. It is the dummy from my first right-click on Whatsie, and Whatsie's menu from the second click was still open.

Steps to reproduce

Right-click an AppIndicator tray icon, close the menu, and right-click the same icon again. The second popup frees the first dummy every time, but whether the watcher then segfaults depends on the heap, so it can take many tries.

Expected behavior

The menu opens and xapp-sn-watcher keeps running.

Additional information

A gdb watchpoint on the dummy's ref_count showed 2 at gtk_menu_popup_at_rect, 1 after gdk_event_free (xapp-status-icon.c:383), and 0 inside the second popup's g_object_set_data_full (line 367), before the DestroyNotify arrived. A right-click loop on a separate X display with the packaged 3.2.4 crashed in 3 of 5 runs, same frame #0, and the other 2 survived 200 cycles. With c445c22 applied on top of 3.2.4 the dummy stays alive until GDK has handled its DestroyNotify and dropped the XID.

c445c22 is on master but not on 3.2-maintenance, so Mint 22 still has the bug. Could it go into the next 3.2.x? Happy to test a build, or to send the cherry-pick as a PR if that is easier.

主要言語
C
スター
173
フォーク
52
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

linuxmint/xapp のほかの issue

linuxmint/xapp の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。