Discordia icon indicating copy to clipboard operation
Discordia copied to clipboard

Deleted objects have a chance to be recreated without applying updates if created again before GC run

Open BestMordaEver opened this issue 5 months ago • 0 comments

Example with the permission overwrites, but I can see this potentially happening with other objects too

client:on("ready", function ()
  local guild = client:getGuild(" ")
  local channel = client:getChannel(" ")
  local member = guild:getMember(" ")
  local prePO = channel:getPermissionOverwriteFor(member)
  prePO:allowPermissions(1024, 16)
  print(prePO:getAllowedPermissions()) -- Permissions: 1040 (manageChannels, readMessages)
  prePO:delete()
  prePO = nil

  local timer = require "timer"
  timer.setTimeout(10*1000, function()
    print(channel:getPermissionOverwriteFor(member):getAllowedPermissions()) -- Permissions: 1040 (manageChannels, readMessages)
  end)
end)

The print inside setTimeout is expected to print Permissions: 0 (none), since the old permission overwrite was deleted

BestMordaEver avatar Aug 28 '24 09:08 BestMordaEver