Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
Fix selfAsyncCall error bug
Browse files Browse the repository at this point in the history
  • Loading branch information
metatablecat committed Jul 23, 2024
1 parent 343c425 commit 03bff1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/lib/Dispatcher.luau
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ function Dispatcher.slotAwait(o)
return true
end

if Dispatcher.isSelfAsyncCall(o) then
ERROR.OBJECT_SELF_AWAIT(o:GetID(true))
coroutine.yield() -- we can probably kill the thread but this is for compatiblity
return true -- if the thread somehow resumes (shouldn't, provides safe fallback)
end

table.insert(state.HeldThreads, coroutine.running())
return coroutine.yield()
end
Expand Down
3 changes: 1 addition & 2 deletions src/lib/Object.luau
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ return function(params: {[string]: any}, service)
function raw:Await()
REFLECTION.CUSTOM(1, "Object.Await", self, OBJECT_REFLECTION_TEST)

if Dispatcher.isSelfAsyncCall(self) then ERROR.OBJECT_SELF_AWAIT(self:GetID(true)) end
return Dispatcher.slotAwait(self)
end

Expand All @@ -70,11 +69,11 @@ return function(params: {[string]: any}, service)
REFLECTION.CUSTOM(1, "Object.Destroy", self, OBJECT_REFLECTION_TEST)

if not self[Common.ObjectHeader] then ERROR.BAD_SELF_CALL("Object.Destroy") end
local service = OBJECT_PRIVATE[self].Service
local state = Dispatcher.getObjectState(self)

if state then
Dispatcher.cleanObjectState(self)
local service = OBJECT_PRIVATE[self].Service
OBJECT_PRIVATE[self] = nil

local destroying = self.Destroying
Expand Down

0 comments on commit 03bff1b

Please sign in to comment.