Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Possible memory leak when reloading images in MarkdownTextBlock

Aperta
#772 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
desktop-dev

Direzione di ricerca

Inizia con i percorsi degli handler MarkdownTextBlock Init() e LoadImage descritti nell’issue, concentrandoti sulla sostituzione dell’istanza _image tramite IImageProvider. Definisci un caso riproducibile di ricaricamento dell’immagine, quindi verifica con un controllo delle perdite appropriato che la sostituzione delle immagini non conservi handler Loaded o oggetti obsoleti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug :bug:
Describe the bug

Found by Copilot in https://github.com/CommunityToolkit/Labs-Windows/pull/771/

When using IImageProvider, the _image instance is replaced with a new Image object from the provider. This means the Loaded event handler attached in Init() is lost, since it was attached to the original _image instance. However, since this code is already executing within the LoadImage handler and _loaded is set to true immediately after, this might work correctly. Consider whether the event handler should be detached from the old image or if there's a risk of memory leaks from the orphaned handler on the original image object.

Steps to reproduce
Unknown, need investigation.
Expected behavior

No memory leaks when images are changed.

Screenshots

No response

Code Platform
  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK
Windows Build Number
  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)
Other Windows Build number

No response

App minimum and target SDK version
  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)
Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item.

Lingua principale
C#
Stelle
483
Fork
89
Merge medio
4g 5h
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CommunityToolkit/Labs-Windows

Tutte le issue di CommunityToolkit/Labs-Windows

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.