On Mon Apr 24 09:58:38 2023 +0000, Jacek Caban wrote:
This looks hackish. For example, releasing HTML document may happen while processing other document's script. If that's the case, you'd flush other document's events, which does not seem desired. More generally, I'm not sure what you're trying to fix. We try to force CC run when releasing a document is released because it's nice if it's able to collect objects at that point. But if CC fails to clean up things right away, it's also fine as long as it will clean up things on later run. The next two commits seem similarly controversial.
Somehow it doesn't end up cleaning them later. This is obvious in tests, which is where I tried to remove leaks because it's much easier to reproduce with a clean run.
Without this patch it will be hard to analyze test leaks and see if stuff is truly leaking or not, because it ends up leaking in the tests of course, but the process exits so it doesn't actually matter there. On "real" apps it will be hard as well.
Note that the CC never gets shutdown. So in theory if an app stops processing messages, it will never clean the leaks. I'm not sure if this is possible by deregistering gecko's wndprocs somehow, but it's a possible issue.
We can't trigger a shutdown in the CC either (although it requires wine-gecko API changes), because we don't know when it's truly shutting down. A new document obj can be created at any time, etc. The current behavior isn't an issue if Firefox is the app running but it is for us in embedded situation.
Do you have some ideas here? Maybe I'm missing something.