Skip to content

Memory leak when closing window #197

Closed

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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