Skip to content

Memory leak when closing window #197

Open
@dathinaios

Description

@dathinaios

As reported at robbert-vdh/nih-plug#173. I can reproduce on a Mac on Bitwig and Reaper on a nih_plug plugin (parented window).

The following addition on WindowInner's close function for Mac resolves the issue for me on Mac:

// Ensure all subviews are detached and released
let subviews: id = msg_send![self.ns_view, subviews];
let count: usize = msg_send![subviews, count];
for i in 0..count {
    let subview: id = msg_send![subviews, objectAtIndex: i];
    subview.removeFromSuperview();
    let () = msg_send![subview, release];
}

A similar change need to happen on Windows and Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions