From fe790f2f65b8f26199df0774a389d3c549b7c8bd Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Thu, 22 Dec 2016 11:26:35 +0000 Subject: [PATCH] Layout: Ignore NaN numbers when updating regions In Cinnamon 3.2, the "Window List with App Groups" applet caused issues. The panel and windows wouldn't be clickable anymore. This was caused by NaN being returned by let [x, y] = actorData.actor.get_transformed_position() and let [w, h] = actorData.actor.get_transformed_size() and an exception being thrown when doing: let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h}); It's ok for the applet to fail if it references obsolete code but it shoudn't affect Cinnamon as a whole. When numbers are NaN, skip the actor altogether to ensure the regions are being updated correctly. Ideally we would log the issue, but this loop is too sensitive and loops way too fast for that, it would make Cinnamon lag significantly to do that. --- js/ui/layout.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/ui/layout.js b/js/ui/layout.js index 4e15879507..ba0a821ac1 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -698,6 +698,14 @@ Chrome.prototype = { let [x, y] = actorData.actor.get_transformed_position(); let [w, h] = actorData.actor.get_transformed_size(); + + if (isNaN(x) || isNaN(y) || isNaN(w) || isNaN(h)) { + // If the actor isn't giving us a valid size/position, skip it + // It would make the loop fail with an exception and affect the + // other actors + continue; + } + x = Math.round(x); y = Math.round(y); w = Math.round(w);