{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":586013529,"defaultBranch":"master","name":"baseview","ownerLogin":"vizia","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2023-01-06T17:49:34.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/99990842?v=4","public":true,"private":false,"isOrgOwned":true},"refInfo":{"name":"","listCacheKey":"v0:1673027375.206768","currentOid":""},"activityList":{"items":[{"before":"c129b12ead4f5ac02126f559ceb8ce43cc982200","after":"2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4","ref":"refs/heads/master","pushedAt":"2023-12-30T18:18:06.000Z","pushType":"push","commitsCount":50,"pusher":{"login":"geom3trik","name":"Dr George Atkinson","path":"/geom3trik","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/9365407?s=80&v=4"},"commit":{"message":"Fix window cleanup logic on macOS (#164)\n\nInstead of trying to detect when to clean up the window based on the `NSView`'s retain count, require window cleanup to be initiated explicitly via `Window::close`, `WindowHandle::close`, or `[NSWindowDelegate windowShouldClose:]` (in non-parented mode; called when the user clicks the \"X\" button). This fixes the leaks and use-after-frees that can be caused by the inherent unreliability of the retain count logic.\r\n\r\nAs discussed in #153, this change essentially means that the `NSView` created by Baseview will not be suitable as the top-level view for an Audio Unit, since the Baseview API now requires that child windows be cleaned up by an explicit call to `WindowHandle::close`, and the only reliable signal for cleaning up an Audio Unit view is a call to `[NSView dealloc]`. However, this does not mean that Baseview cannot be used in the context of an Audio Unit; it just means that plugin frameworks must implement a compatibility layer with a wrapper `NSView` (which is the approach taken by JUCE).\r\n\r\nIn order to implement this change:\r\n\r\n- `WindowState` is stored in an `Rc` rather than a `Box`.\r\n- `WindowHandle` holds an `Rc` so that `WindowHandle::close` can directly invoke window cleanup logic.\r\n- Since the window can be closed during an event handler, `WindowState::from_view` now returns a clone of the `Rc` held by the `NSView` to ensure that it lives until the end of an event handler.\r\n- In the non-parented case, the `NSView` is set as the window delegate, which allows it to receive the `windowShouldClose:` call when the user clicks the \"X\" button, upon which it will dispatch the `WillClose` event and initiate window cleanup logic.\r\n- `Window::open_parented` and `open_blocking` no longer `release` the `NSView` immediately after attaching it. Instead, the `NSView` is released as part of the cleanup logic in `WindowInner::close`.\r\n- `Window::resize` now checks if the window is open to avoid using the `NSView` after releasing it.\r\n- The overridden `release` method, the `retain_count_after_build` field, the `ParentHandle` struct, and the `close_requested` flag have all been removed.","shortMessageHtmlLink":"Fix window cleanup logic on macOS (RustAudio#164)"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAAD1K-wMAA","startCursor":null,"endCursor":null}},"title":"Activity ยท vizia/baseview"}