mapbox / mapbox/mapbox-maps-flutter

Calling easeTo may be creating a memory leak

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

Nessuno ha ancora preso questa issue.

Lingua principale
Dart
Stelle
380
Fork
204
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have a handful of buttons on top of my Mapbox map that perform various functions with the map. One of them is a "3D view toggle". This function just calls easeTo. Im getting some strange behaviour after interacting with this button that I dont get at all if I dont touch it. Ive attached the code were using as well as a video of what this issue looks like.

Mapbox SDK Version: Seems to be all
Testing on iOS

```
void _togglePitch() {
// Prevent multiple simultaneous pitch changes
if (_isEasingInProgress) {
return;
}

// Ensures mapboxMap is not null before attempting to use it
if (mapboxMap == null) {
debugPrint('MapboxMap is not initialized');
return;
}

try {
// Set flag to prevent additional calls
setState(() {
_isEasingInProgress = true;
is3D = !is3D;
});

mapboxMap!.easeTo(
CameraOptions(pitch: is3D ? 75 : 0),
MapAnimationOptions(duration: 1000),
).then((_) {
// Reset the flag when animation is complete
setState(() {
_isEasingInProgress = false;
});
}).catchError((error) {
debugPrint('Error toggling pitch: $error');
setState(() {
is3D = !is3D;
_isEasingInProgress = false;
});
});
} catch (e) {
debugPrint('Error toggling pitch: $e');
// Optionally, reverts the state if the pitch change fails
setState(() {
is3D = !is3D;
_isEasingInProgress = false;
});
}
}
```

https://github.com/user-attachments/assets/153d13f6-0723-4a1c-b634-0aaa5388c295

![IMG_4938](https://github.com/user-attachments/assets/6b0a9337-484e-4301-91af-8531ad5bbff3)

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Inizia con la funzione _togglePitch fornita e la relativa chiamata a easeTo, quindi riproduci il comportamento segnalato su iOS usando il codice e il video allegati. Confronta il comportamento con e senza l'interruttore 3D nelle versioni SDK indicate; il lavoro è completo quando il comportamento della memoria è spiegato e viene documentata una riproduzione minima o la causa confermata.

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

Valutazione

Stack tecnologico
dart, flutter
Ambito
mobile-dev
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.