rncbc / qpwgraph

qpwgraph - A PipeWire Graph Qt GUI Interface
https://gitlab.freedesktop.org/rncbc/qpwgraph
GNU General Public License v2.0
246 stars 15 forks source link

Occasional crash due to heap-use-after-free #41

Closed Oppzippy closed 4 months ago

Oppzippy commented 4 months ago

Occurs generally after running for 10+ hours. I'm not sure how to reproduce it consistently.

Here's a crash log when running in debug mode: qpwgraph-error-log.txt

rncbc commented 4 months ago

please check whether 4e7ca10, in develop branch, is a possible mitigation?

Oppzippy commented 4 months ago

Thanks for the quick response. I'll report back in a week or so if 4e7ca1088b73c784040805d32298a3a320e12644 doesn't crash at all by then.

Oppzippy commented 4 months ago

The issue still occurs: qpwgraph-error-log.txt

rncbc commented 4 months ago

thanks; you seem to have View > Repel Overlapping Nodes turned on, can you check if the issue occurs if turned off?

Oppzippy commented 4 months ago

It still happens with that setting off: qpwgraph-error-log.txt

rncbc commented 4 months ago

thanks again; is it occurring more often now? so that you can reproduce it so quickly? is there any particular actions or system environment to trigger the issue so easily? (here failing to reproduce it since the first reply, no matter what)

EDIT: also try with newer b07fec8 (develop)

Oppzippy commented 4 months ago

b07fec845ed05b3e4e1d311433b700030153c90b seems to have fixed it, thanks!

Oppzippy commented 4 months ago

Based on what the fix was, it does look like there could be other code paths that lead to a use after free that I'm not encountering. I don't know the full context, so I could be missing something, but whenever removeItem doesn't actually remove the item from m_nodes, it looks like that would be an issue, since everything in the nodes list is freed regardless of whether or not they were actually removed.

https://github.com/rncbc/qpwgraph/blob/b07fec845ed05b3e4e1d311433b700030153c90b/src/qpwgraph_canvas.cpp#L495-L498

Just mentioning this in case it's worth looking into. I haven't actually encountered any issues due to it.