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

fix(menu): Preferences… from the title-bar menu throws "Looking up a deactivated widget's ancestor is unsafe"

Aperta Adatta ai principianti
#1,777 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
dart, flutter
Ambito
desktop, frontend

Direzione di ricerca

Leggi lib/features/main_screen/querya_window_title_bar.dart, lib/shared/widgets/querya_context_menu.dart:58-67 e lib/shared/widgets/app_dialog.dart:25 per ricostruire il percorso del contesto del callback del menu fino al dialogo. Riproduci il problema con un clic reale del puntatore, poi aggiungi il test del widget proposto che apre il menu e tocca la voce. Il lavoro è completato quando il dialogo si apre senza attivare l’asserzione sul contesto disattivato.

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

Descrizione

bug

Problem

Choosing Edit → Preferences… in the title-bar menu throws in the scheduler callback (seen in a debug run, Linux):

Looking up a deactivated widget's ancestor is unsafe.
#3 Localizations.of
#6 MaterialLocalizations.of
#7 showAppDialog (lib/shared/widgets/app_dialog.dart:25)
#8 showPreferencesDialog (lib/features/settings/preferences_dialog.dart:30)
#9 QueryaWindowTitleBar.build.<anonymous closure> (lib/features/main_screen/querya_window_title_bar.dart:251)
#10 QueryaMenuItem.build.<anonymous closure> (lib/shared/widgets/querya_context_menu.dart:65)
#11 _MenuItemButtonState._handleSelect

QueryaMenuItem passes its own context to onPressed(ctx). By the time showAppDialog runs (the menu closes first, the call lands in a frame callback) that element is deactivated, so MaterialLocalizations.of(context) asserts. In a release build the assertion is off, so the symptom there is not known; it was not checked.

Not reproduced through a semantic tap (it calls onPressed before the menu closes); it needs a real pointer click. "Go to Object…" and the other items use the same ctx, so they may have the same problem; not checked.

Proposal

Open the dialog with a context that outlives the menu (the title bar's own context or the root navigator, as _dialogAnchorContext in connection_creation_flow.dart does), or give QueryaMenuItem a context that is still mounted. Add a widget test that opens a menu, taps the item and expects the dialog.

Where

  • lib/features/main_screen/querya_window_title_bar.dart (the onPressed: (ctx) => ... items)
  • lib/shared/widgets/querya_context_menu.dart:58-67
  • `lib/shared/widgets/app_dialog.dart:25
Lingua principale
Dart
Stelle
23
Fork
1
Merge medio
45m
PR unite (30g)
529

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 QueryaHub/Querya-Desktop

Tutte le issue di QueryaHub/Querya-Desktop

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.