Skip to content

Bug: GemmaEmbeddingService.dispose() doesn't cancel in-flight initialization #5

@0xharkirat

Description

@0xharkirat

Priority: High

Unlike SlotFillingService which has a _disposed flag, GemmaEmbeddingService simply nulls out references in dispose(). If initialization is still running (e.g., model download), it will continue and eventually call notifyListeners() on a disposed ChangeNotifier, throwing a Flutter assertion error.

Recommended fix

Add a _disposed flag (matching SlotFillingService pattern) and check it at the end of _initialize() before setting state.

Files

  • lib/services/gemma_embedding_service.dart (lines 44-51)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions