Skip to content

Commit

Permalink
Fix scenario with removing project from shared object coockies
Browse files Browse the repository at this point in the history
- There were scenario (probably manual rename projects) where shared cookies contains some older references of projects. In some edge cases this causes unability to properly close project - after restart moonshine project were always opening again (closes #864)
  • Loading branch information
piotrzarzycki21 committed Jun 25, 2021
1 parent b2a1c58 commit 462d052
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ package actionScripts.utils
propertyNameKeyValue:String, cookieName:String):Boolean
{
var cookie:Object = SharedObject.getLocal(SharedObjectConst.MOONSHINE_IDE_PROJECT);
var itemsRemoved:Boolean = false;

if (item && item.hasOwnProperty(propertyNameKeyValue) && item.hasOwnProperty(propertyNameKey))
{
Expand All @@ -307,19 +308,20 @@ package actionScripts.utils
for (var i:int = 0; i < data[cookieName].length; i++)
{
var itemForRemove:Object = data[cookieName][i];
var itemForRemoveProperty:String = itemForRemove[item[propertyNameKey]];
var itemValue:String = item[propertyNameKeyValue];
if (itemForRemove.hasOwnProperty(item[propertyNameKey]) &&
itemForRemoveProperty == itemValue)
if (itemForRemove.hasOwnProperty(item[propertyNameKey]))
{
data[cookieName].removeAt(i);
cookie.flush();
return true;
itemsRemoved = true;
}
}
}

return false;
if (itemsRemoved)
{
cookie.flush();
}

return itemsRemoved;
}

private static function removeProjectLefovers(item:Object, propertyNameKeyValue:String):void
Expand Down

0 comments on commit 462d052

Please sign in to comment.