microsoft / microsoft/microsoft-ui-xaml

ScrollView doesn't use safe reference counting to hide indicators

Open
#10,514 3 comments 0 reactions 1 assignee Claimed by @Hemantxk View on GitHub
area-Pointer area-Scrolling bug needs-assignee-attention needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

We have a crash in our app, which is attributed to the `ScrollView::OnHideIndicatorsTimerTick` method that happens after a window has been closed. Looking at [the implementation ](https://github.com/microsoft/microsoft-ui-xaml/blob/268e06867114c04cc0f25201b57f64e326113ba0/src/controls/dev/ScrollView/ScrollView.cpp#L1769) of how this event is registered, it is just grabbing a raw `this` pointer, so there is no guarantee the pointer is valid once the object has been destroyed.

C++/Winrt docs describing this issue: https://learn.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/weak-references#the-issue

### Steps to reproduce the bug

So timing related, good luck reproducing

### Expected behavior

_No response_

### Screenshots

_No response_

### NuGet package version

None

### Windows version

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.