Skip to content

Commit

Permalink
fix: macOS NSView release call
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm authored Sep 3, 2022
1 parent 14e4878 commit 193304d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- macOS: Fix memory leak in `Surface`.

# Version 0.30.0-beta.1 (2022-09-03)

- Replace `winit` dependency with `raw-window-handle`.
Expand Down
4 changes: 2 additions & 2 deletions glutin/src/api/cgl/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Display {
let inner = Arc::new(ConfigInner {
display: self.clone(),
raw: NSOpenGLPixelFormatId(raw),
transrarency: template.transparency,
transparency: template.transparency,
});
let config = Config { inner };

Expand Down Expand Up @@ -193,7 +193,7 @@ impl Sealed for Config {}

pub(crate) struct ConfigInner {
display: Display,
pub(crate) transrarency: bool,
pub(crate) transparency: bool,
pub(crate) raw: NSOpenGLPixelFormatId,
}

Expand Down
2 changes: 1 addition & 1 deletion glutin/src/api/cgl/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Display {
let raw = NSOpenGLContext::alloc(nil)
.initWithFormat_shareContext_(*config.inner.raw, share_context as *mut _);

if config.inner.transrarency {
if config.inner.transparency {
let opacity = 0;
super::check_error(CGLSetParameter(
raw.CGLContextObj().cast(),
Expand Down
2 changes: 1 addition & 1 deletion glutin/src/api/cgl/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<T: SurfaceTypeTrait> Drop for Surface<T> {
fn drop(&mut self) {
unsafe {
if self.ns_view != nil {
let _: () = msg_send![self.ns_view, retain];
let _: () = msg_send![self.ns_view, release];
}
}
}
Expand Down

0 comments on commit 193304d

Please sign in to comment.