fix: Fixed gc issue

This commit is contained in:
Qwreey 2023-01-05 01:59:06 +09:00
parent 24e5e7f52a
commit d10936a57e
2 changed files with 12 additions and 7 deletions

View file

@ -115,7 +115,7 @@ function scrollFrame:render(props)
BackgroundColor3 = props "BackgroundColor3";
ZIndex = props "ZIndex";
ClipsDescendants = true;
[event.createdSync] = function (this)
[event.created] = function (this)
this.InputChanged:Connect(function (input)
if self._mouseDown or self._scrollbarDown then
return;
@ -172,7 +172,7 @@ function scrollFrame:render(props)
Size = props "CanvasSize";
ZIndex = props "ZIndex";
Position = UDim2.fromOffset(self._targetX,self._targetY);
[event.createdSync] = function (this)
[event.created] = function (this)
self._holder = this;
end;
};
@ -180,7 +180,7 @@ function scrollFrame:render(props)
AnchorPoint = props "ScrollbarPositionY":with(function (_,value)
return value == "Right" and Vector2.new(1,0) or Vector2.new(0,0);
end);
[event.createdSync] = function (this)
[event.created] = function (this)
self._scrollbarY = this;
end;
Position = props.ScrollbarPositionY == "Right" and UDim2.new(1,0,0,0) or UDim2.new(0,0,0,0);
@ -201,7 +201,7 @@ function scrollFrame:render(props)
AnchorPoint = props "ScrollbarPositionX":with(function (_,value)
return value == "Top" and Vector2.new(0,0) or Vector2.new(0,1);
end);
[event.createdSync] = function (this)
[event.created] = function (this)
self._scrollbarX = this;
end;
Position = props.ScrollbarPositionX == "Top" and UDim2.new(0,0,0,0) or UDim2.new(0,0,1,0);

View file

@ -250,6 +250,7 @@ function module.init(shared)
function new.__initStoreRegisterBinding(self,withItem)
local selfTweens = self.__tweens;
local selfValues = self.__self;
local selfKeep = self.__keep;
for key,item in pairs(selfValues) do
if type(item) == "table" and item.__type == "quad_register" then
-- fetch data from origin
@ -270,11 +271,14 @@ function module.init(shared)
end
-- make event connection
item:register(function (_,newValue,eventKey)
local function regFn(_,newValue,eventKey)
-- !HOLD IT SELF TO PREVENT THIS REGISTER BEGIN REMOVED FROM MEMORY
local setValue = item:calcWithNewValue(withItem,newValue,eventKey);
self[key] = setValue;
end);
end
item:register(regFn);
insert(selfKeep,item);
insert(selfKeep,regFn);
end
end
end
@ -311,7 +315,8 @@ function module.init(shared)
__self = self or {}, -- real value storage
__evt = {}, -- changed event handler functions (dict of array)
__reg = setmetatable({},week), -- save registers
__tweens = {} -- tweens (if inited with register, save tween and use as default tween data)
__tweens = {}, -- tweens (if inited with register, save tween and use as default tween data)
__keep = {} -- store data which should not be destoryed
},store
);
if id then -- save in id space