Skip to content

Destroy control properly before UIng.uninit #19

@kojix2

Description

@kojix2

The current strategy of parent controls owning child controls works well in most cases. However, for more complex controls like MultilineEntry, memory deallocation may not complete in time before UIng.uninit is called. Since UIng.uninit checks whether memory has been properly freed, errors can occur when garbage collection is delayed. To prevent this, it's safer to explicitly destroy the main window before calling UIng.uninit.


Comment by DeepWIki

Complex internal data structures: MultilineEntry is particularly problematic because it contains special data structures like uiprivScrollViewData that require proper destruction order.

Other controls with similar issues: Controls that may experience similar problems include:

  • Table: Has complex internal structures with ScrollView and model relationships
  • Grid: Manages complex constraint systems and multiple child controls
  • Tab: Manages multiple child controls and delegates
  • Area: When using ScrollView functionality

Common pattern: These problematic controls typically share characteristics such as ScrollView system usage, management of multiple internal data structures, and requirements for specific destruction order.

Simple controls (Button, Label, Checkbox, etc.) have straightforward structures and are less likely to cause issues with delayed GC cleanup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions