Skip to content

Commit

Permalink
AtSpi2: Fix stack overflow caused by LimitPolling.
Browse files Browse the repository at this point in the history
  • Loading branch information
madewokherd committed Oct 7, 2024
1 parent c6c75b0 commit e0a6fbb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion xalia/AtSpi2/AtSpiConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public PollDispoable(AtSpiConnection connection, string peer)
this.peer = peer;
}

public void Dispose()
public void RealDispose()
{
var count = connection.poll_count[peer];

Expand All @@ -294,6 +294,22 @@ public void Dispose()
}
connection.poll_count[peer] = count - 1;
}

public void Dispose()
{
if ((connection.poll_known_sources.TryGetValue(peer, out var known_sources) &&
known_sources.Count != 0) ||
(connection.poll_unknown_sources.TryGetValue(peer, out var unknown_sources) &&
unknown_sources.Count != 0))
{
// this may resume a task, add some delay so we don't do this recursively
Utils.RunIdle(RealDispose);
}
else
{
connection.poll_count[peer]--;
}
}
}
}
}

0 comments on commit e0a6fbb

Please sign in to comment.