Skip to content

Commit abb3e70

Browse files
committed
fix: macOS axWindows map
1 parent 5294079 commit abb3e70

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/macos.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ AXUIElementRef getAXWindow(int pid, int handle) {
9797
obj.Set("id", [windowNumber intValue]);
9898
obj.Set("processId", [ownerPid intValue]);
9999
obj.Set("path", [app.bundleURL.path UTF8String]);
100-
m[[windowNumber intValue]] = getAXWindow([ownerPid intValue], [windowNumber intValue]);
100+
101+
if (m.find([windowNumber intValue]) == m.end()) {
102+
m[[windowNumber intValue]] = getAXWindow([ownerPid intValue], [windowNumber intValue]);
103+
}
101104

102105
return obj;
103106
}
@@ -138,7 +141,10 @@ AXUIElementRef getAXWindow(int pid, int handle) {
138141
obj.Set("path", [app.bundleURL.path UTF8String]);
139142
obj.Set("bounds", boundsObj);
140143
obj.Set("title", [windowName UTF8String]);
141-
m[[windowNumber intValue]] = getAXWindow([ownerPid intValue], [windowNumber intValue]);
144+
145+
if (m.find([windowNumber intValue]) == m.end()) {
146+
m[[windowNumber intValue]] = getAXWindow([ownerPid intValue], [windowNumber intValue]);
147+
}
142148

143149
return obj;
144150
}

0 commit comments

Comments
 (0)