Feedback
Canvas Paint can fire after window close when Me.Parent is Nothing
- Status
- Accepted
- Fixed in
- -
- Area
- desktop
- Source discussion
- https://forum.objo.dev/d/1223-app-closing-destruction-order
- Last updated
- 2026-09-29
Upvotes
0 upvotes
Uses your Objo forum account.
Public summary
Closing a window can trigger one extra Paint event on a Canvas child control after the window's teardown has already started. At that point Me.Parent returns Nothing, so any paint handler that reads a property on its parent window fails with:
NothingReferenceException: Cannot read property '<name>' because the receiver is Nothing.
The failure is intermittent because it depends on renderer timing during the close sequence. Users can work around it by guarding the paint body with If Me.Parent <> Nothing Then ... End If.