[client] overlay/graphs: allow unregistering after shutdown

The Wayland display server has a graph for presentation times, but the
backend shuts down after the overlays, so calling
overlayGraph_unregister causes memory corruption. We can avoid this
problem by making unregister a noop after all graphs have been freed.

This is safe because updating the graph doesn't use the graph handle:
instead you update the ringbuffer which is owned by the user.
This commit is contained in:
Quantum 2022-05-27 01:42:49 -04:00 committed by Geoffrey McRae
parent fba7c80b2f
commit 712b1cbc46

View File

@ -89,6 +89,7 @@ static void graphs_free(void * udata)
while(ll_shift(gs.graphs, (void **)&graph))
free(graph);
ll_free(gs.graphs);
gs.graphs = NULL;
}
struct BufferMetrics
@ -239,6 +240,9 @@ GraphHandle overlayGraph_register(const char * name, RingBuffer buffer,
void overlayGraph_unregister(GraphHandle handle)
{
if (!gs.graphs)
return;
ll_removeData(gs.graphs, handle);
free(handle);