Skip to content

Commit

Permalink
Clone WindowCapability to prevent modification of stored WindowCapabi…
Browse files Browse the repository at this point in the history
…lity in SystemCapabilityManager
  • Loading branch information
JulianKast committed Sep 7, 2022
1 parent 024e0dd commit 0bd233e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,11 @@ public WindowCapability getWindowCapability(int windowID) {
for (WindowCapability windowCapability : display.getWindowCapabilities()) {
int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
if (currentWindowID == windowID) {
// Clone WindowCapability to prevent modification of stored WindowCapability in SystemCapabilityManager
WindowCapability updatedCaps = (WindowCapability) windowCapability.clone();
// A null windowID is assumed to be the DefaultWindow according to the spec, but that can be hard for developers to check, so set it explicitly.
windowCapability.setWindowID(windowID);
return windowCapability;
updatedCaps.setWindowID(windowID);
return updatedCaps;
}
}
return null;
Expand Down

0 comments on commit 0bd233e

Please sign in to comment.