Commit 9a876de
Fix undisposed PointerEvent JSObject on browser pointer move (#22112)
* Fix undisposed PointerEvent JSObject on browser pointer move
OnPointerMove dropped argsObj (the JSObject wrapping the native DOM
PointerEvent) without disposing it, except inside a Lazy factory only
evaluated when GetIntermediatePoints() is called - which doesn't happen
for ordinary moves/hover.
Without explicit Dispose(), release requires two steps: Mono GC must
collect the abandoned JSObject wrapper to release its JS handle, then
V8 can reclaim the underlying JS object. Verified with a standalone
FinalizationRegistry-based repro that Mono GC does not trigger on its
own under continuous pointermove-like allocation pressure, so undisposed
objects pile up - not a permanent leak though.
Fix by disposing argsObj in a finally block after routing, guaranteeing
deterministic release instead of depending on GC timing. Coalesced-event
resolution (GetCoalescedEvents) is unaffected since it only runs
synchronously within the same call when a consumer needs it.
* Updated comments
* Update src/Browser/Avalonia.Browser/BrowserInputHandler.cs
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* Return empty list in lazy if argsObj has been disposed
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>1 parent 5846116 commit 9a876de
1 file changed
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
85 | | - | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | | - | |
105 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
106 | 117 | | |
107 | 118 | | |
108 | 119 | | |
| |||
0 commit comments