Skip to content

Commit

Permalink
Roll back one of the hs.application memory leak fixes because it caus…
Browse files Browse the repository at this point in the history
…es crashes
  • Loading branch information
cmsj committed Jul 12, 2018
1 parent fa4caa1 commit 894344c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions extensions/application/internal.m
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ AXUIElementRef _findmenuitembypath(lua_State* L __unused, AXUIElementRef app, NS
// searchItem will be the generic variable we search in our loop
searchItem = menuBar;

CFArrayRef cf_children = NULL;
// Loop over cf_children for first element in path, then descend down path
int i = 5000; // Guard ourself against infinite loops
while (!foundItem && i > 0) {
Expand All @@ -680,7 +681,6 @@ AXUIElementRef _findmenuitembypath(lua_State* L __unused, AXUIElementRef app, NS
break;
}

CFArrayRef cf_children;
error = AXUIElementCopyAttributeValues(searchItem, kAXChildrenAttribute, 0, count, &cf_children);
if (error) {
[skin logBreadcrumb:@"Failed to get children"];
Expand Down Expand Up @@ -745,7 +745,6 @@ AXUIElementRef _findmenuitembypath(lua_State* L __unused, AXUIElementRef app, NS
break;
}
}
CFRelease(cf_children);

if (!found) {
[skin logBreadcrumb:@"Unable to resolve complete search path"];
Expand Down

0 comments on commit 894344c

Please sign in to comment.