Skip to content

Commit

Permalink
OSX: Fix memory leaks
Browse files Browse the repository at this point in the history
Fixes #774
  • Loading branch information
hluk committed Sep 2, 2017
1 parent b89061b commit 7f0285e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/platform/mac/macplatformwindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ pid_t getPidForWid(WId find_wid) {
unsigned long int wid = (unsigned long) [(NSNumber*)[dict objectForKey:@"kCGWindowNumber"] longValue];

if (wid == find_wid) {
CFRelease(array);
return pid;
}
}
CFRelease(array);

return 0;
}
Expand All @@ -117,6 +119,7 @@ long int getTopWindow(pid_t process_pid) {
widsForProcess.insert(wid);
}
}
CFRelease(array);

// Now look through the windows in NSWindowList (which are ordered from front to back)
// the first window in this list which is also in widsForProcess is our frontmost "normal" window
Expand Down Expand Up @@ -146,6 +149,8 @@ QString getTitleFromWid(long int wid) {
for (NSDictionary* dict in array) {
title = QString::fromNSString([dict objectForKey:@"kCGWindowName"]);
}

CFRelease(array);
CFRelease(windowArray);

return title;
Expand Down

0 comments on commit 7f0285e

Please sign in to comment.