Skip to content

419140 Fix use-after-free in the resource server

Amy spark requested to merge amyspark/419140-fix-crash-resource-server into krita/4.3

Sometimes (under Windows), the main window (and the palette docker) gets destroyed before the palettes' resource server. Since the docker does not remove itself as an observer in its destructor, the resource server will do it on destruction -- thus trying to access a long dead object.

It is interesting to see that this use-after-free happens:

  • 100% reliably on Windows only
  • and, to the best of my knowledge, with debug builds.

BUG: 419140
CCMAIL: kimageshop@kde.org

Test Plan

Build and run Krita, under Windows 10 (for maximum reliability), with the packaging scripts.

Open any document, and then close Krita.

Check that there is no crash on exit.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Merge request reports

Loading