Skip to content

Commit ef9c54b

Browse files
committed
fix: prevent segfault in status_handler when downloading a game in list view
1 parent 7cca449 commit ef9c54b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/ui/views/GamesView/list/GameListRow.vala

+7
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,14 @@ namespace GameHub.UI.Views.GamesView.List
270270

271271
private void status_handler(Game.Status s)
272272
{
273+
// Use weak reference to avoid capturing `this` strongly
274+
weak GameListRow weak_self = this;
275+
273276
Idle.add(() => {
277+
// early return when GameCard got destructed to prevent segfault
278+
if (weak_self == null)
279+
return Source.REMOVE;
280+
274281
label.label = game.name;
275282
status_label.label = s.description;
276283
tooltip_markup = """<span weight="600">%s</span>""".printf(game.name.replace("&amp;", "&").replace("&", "&amp;")) + "\n" + """<span size="smaller">%s</span>""".printf(s.description.replace("&amp;", "&").replace("&", "&amp;"));

0 commit comments

Comments
 (0)