fix warnings and some reloading issues

This commit is contained in:
Eduardo Bart 2012-04-27 01:54:14 -03:00
parent da1baf9673
commit d0b839a4eb
28 changed files with 106 additions and 62 deletions

View File

@ -8,8 +8,8 @@ Module
reloadable: false reloadable: false
load-later: load-later:
- client_topmenu
- client_locales - client_locales
- client_topmenu
- client_background - client_background
//- client_about //- client_about
- client_options - client_options

View File

@ -28,7 +28,7 @@ function Locales.init()
Locales.setLocale(defaultLocaleName) Locales.setLocale(defaultLocaleName)
Settings.set('locale', defaultLocaleName) Settings.set('locale', defaultLocaleName)
end end
--[[
addEvent( function() addEvent( function()
localeComboBox = createWidget('ComboBox', rootWidget:recursiveGetChildById('rightButtonsPanel')) localeComboBox = createWidget('ComboBox', rootWidget:recursiveGetChildById('rightButtonsPanel'))
for key,value in pairs(installedLocales) do for key,value in pairs(installedLocales) do
@ -37,6 +37,7 @@ function Locales.init()
localeComboBox:setCurrentOption(currentLocale.languageName) localeComboBox:setCurrentOption(currentLocale.languageName)
localeComboBox.onOptionChange = onLocaleComboBoxOptionChange localeComboBox.onOptionChange = onLocaleComboBoxOptionChange
end, false) end, false)
]]--
end end
function Locales.terminate() function Locales.terminate()

View File

@ -182,6 +182,7 @@ locale = {
["You are burning"] = "Você está queimando", ["You are burning"] = "Você está queimando",
["You are cursed"] = "Você está amaldiçoado", ["You are cursed"] = "Você está amaldiçoado",
["You are dazzled"] = "Você está deslumbrado", ["You are dazzled"] = "Você está deslumbrado",
["You are dead."] = "Você está morto.",
["You are drowing"] = "Você está se afogando", ["You are drowing"] = "Você está se afogando",
["You are electrified"] = "Você está eletrificado", ["You are electrified"] = "Você está eletrificado",
["You are freezing"] = "Você está congelando", ["You are freezing"] = "Você está congelando",

View File

@ -177,19 +177,19 @@ function Terminal.hide()
end end
function Terminal.addLine(text, color) function Terminal.addLine(text, color)
-- create new line label
local numLines = terminalBuffer:getChildCount() + 1
local label = createWidget('TerminalLabel', terminalBuffer)
label:setId('terminalLabel' .. numLines)
label:setText(text)
label:setColor(color)
-- delete old lines if needed -- delete old lines if needed
local numLines = terminalBuffer:getChildCount() + 1
if numLines > MaxLogLines then if numLines > MaxLogLines then
terminalBuffer:getChildByIndex(1):destroy() terminalBuffer:getChildByIndex(1):destroy()
else else
terminalBuffer:setHeight(terminalBuffer:getHeight() + LabelHeight) terminalBuffer:setHeight(terminalBuffer:getHeight() + LabelHeight)
end end
-- create new line label
local label = createWidget('TerminalLabel', terminalBuffer)
label:setId('terminalLabel' .. numLines)
label:setText(text)
label:setColor(color)
end end
function Terminal.executeCommand(command) function Terminal.executeCommand(command)

View File

@ -8,7 +8,7 @@ end
local function tabBlink(tab) local function tabBlink(tab)
if not tab.blinking then return end if not tab.blinking then return end
tab:setOn(not tab:isOn()) tab:setOn(not tab:isOn())
scheduleEvent(function() tabBlink(tab) end, 500) tab.blinkEvent = scheduleEvent(function() tabBlink(tab) end, 500)
end end
-- public functions -- public functions
@ -29,12 +29,14 @@ end
function UITabBar:addTab(text, panel) function UITabBar:addTab(text, panel)
if panel == nil then if panel == nil then
panel = createWidget(self:getStyleName() .. 'Panel') panel = createWidget(self:getStyleName() .. 'Panel')
panel:setId('tabPanel')
end end
local tab = createWidget(self:getStyleName() .. 'Button', self) local tab = createWidget(self:getStyleName() .. 'Button', self)
panel.isTab = true panel.isTab = true
tab.tabPanel = panel tab.tabPanel = panel
tab.tabBar = self tab.tabBar = self
tab:setId('tab')
tab:setText(text) tab:setText(text)
tab:setWidth(tab:getTextSize().width + tab:getPaddingLeft() + tab:getPaddingRight()) tab:setWidth(tab:getTextSize().width + tab:getPaddingLeft() + tab:getPaddingRight())
tab.onClick = onTabClick tab.onClick = onTabClick
@ -55,6 +57,9 @@ function UITabBar:removeTab(tab)
self:selectPrevTab() self:selectPrevTab()
end end
table.remove(self.tabs, index) table.remove(self.tabs, index)
if tab.blinkEvent then
removeEvent(tab.blinkEvent)
end
tab:destroy() tab:destroy()
end end

View File

@ -81,11 +81,15 @@ function Battle.terminate()
battleButton = nil battleButton = nil
battleWindow:destroy() battleWindow:destroy()
battleWindow = nil battleWindow = nil
mouseWidget:destroy()
mouseWidget = nil
disconnect(Creature, { onSkullChange = Battle.checkCreatureSkull, disconnect(Creature, { onSkullChange = Battle.checkCreatureSkull,
onEmblemChange = Battle.checkCreatureEmblem } ) onEmblemChange = Battle.checkCreatureEmblem } )
disconnect(g_game, { onAttackingCreatureChange = Battle.onAttack } ) disconnect(g_game, { onAttackingCreatureChange = Battle.onAttack } )
Battle = nil
end end
function Battle.toggle() function Battle.toggle()

View File

@ -5,10 +5,13 @@ Module
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
icon: battle.png icon: battle.png
dependencies:
- game
@onLoad: | @onLoad: |
dofile 'battle' dofile 'battle'
Battle.init() Battle.init()
@onUnload: @onUnload: |
Battle.terminate() Battle.terminate()

View File

@ -4,6 +4,9 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependencies:
- game
@onLoad: | @onLoad: |
dofile 'combatcontrols' dofile 'combatcontrols'
CombatControls.init() CombatControls.init()

View File

@ -42,17 +42,18 @@ local SayModes = {
[3] = { speakTypeDesc = 'yell', icon = '/core_styles/icons/yell.png' } [3] = { speakTypeDesc = 'yell', icon = '/core_styles/icons/yell.png' }
} }
local MAX_HISTORY = 1000
local MAX_LINES = 100
local consolePanel local consolePanel
local consoleContentPanel local consoleContentPanel
local consoleTabBar local consoleTabBar
local consoleTextEdit local consoleTextEdit
local channels local channels
local messageHistory = { }
local currentMessageIndex = 0
local MaxHistory = 1000
local channelsWindow local channelsWindow
local MAX_LINES = 100
local ownPrivateName local ownPrivateName
local messageHistory = {}
local currentMessageIndex = 0
-- private functions -- private functions
local function navigateMessageHistory(step) local function navigateMessageHistory(step)
@ -252,9 +253,9 @@ function Console.terminate()
consoleContentPanel = nil consoleContentPanel = nil
consoleTabBar = nil consoleTabBar = nil
Console = nil
ownPrivateName = nil ownPrivateName = nil
Console = nil
end end
function Console.clear() function Console.clear()
@ -418,7 +419,7 @@ function Console.sendCurrentMessage()
-- add new command to history -- add new command to history
currentMessageIndex = 0 currentMessageIndex = 0
table.insert(messageHistory, originalMessage) table.insert(messageHistory, originalMessage)
if #messageHistory > MaxHistory then if #messageHistory > MAX_HISTORY then
table.remove(messageHistory, 1) table.remove(messageHistory, 1)
end end

View File

@ -4,7 +4,7 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependecies: dependencies:
- game - game
@onLoad: | @onLoad: |

View File

@ -4,7 +4,7 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependecies: dependencies:
- game - game
@onLoad: | @onLoad: |

View File

@ -63,6 +63,8 @@ function HealthBar.terminate()
manaBar = nil manaBar = nil
healthLabel = nil healthLabel = nil
manaLabel = nil manaLabel = nil
HealthBar = nil
end end
function HealthBar.toggle() function HealthBar.toggle()

View File

@ -4,7 +4,7 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependecies: dependencies:
- game - game
@onLoad: | @onLoad: |

View File

@ -116,6 +116,8 @@ function HotkeysManager.terminate()
hotkeysWindow = nil hotkeysWindow = nil
hotkeysButton:destroy() hotkeysButton:destroy()
hotkeysButton = nil hotkeysButton = nil
HotkeysManager = nil
end end
function HotkeysManager.toggle() function HotkeysManager.toggle()

View File

@ -38,6 +38,8 @@ function Inventory.terminate()
inventoryWindow = nil inventoryWindow = nil
inventoryButton = nil inventoryButton = nil
inventoryPanel = nil inventoryPanel = nil
Inventory = nil
end end
function Inventory.toggle() function Inventory.toggle()

View File

@ -4,7 +4,7 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependecies: dependencies:
- game - game
@onLoad: | @onLoad: |

View File

@ -43,13 +43,15 @@ function Minimap.init()
end end
function Minimap.terminate() function Minimap.terminate()
Keyboard.unbindKeyDown('Ctrl+M')
disconnect(g_game, { onLogin = Minimap.reset }) disconnect(g_game, { onLogin = Minimap.reset })
Keyboard.unbindKeyDown('Ctrl+M')
minimapWidget:destroy() minimapWidget:destroy()
minimapWidget = nil minimapWidget = nil
minimapButton:destroy() minimapButton:destroy()
minimapButton = nil minimapButton = nil
Minimap = nil
end end
function Minimap.toggle() function Minimap.toggle()

View File

@ -4,12 +4,12 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependecies: dependencies:
- game - game
@onLoad: | @onLoad: |
dofile 'minimap' dofile 'minimap'
Minimap.init() Minimap.init()
@onUnload: @onUnload: |
Minimap.terminate() Minimap.terminate()

View File

@ -33,15 +33,15 @@ local WEIGHT_UNIT = 'oz'
function NPCTrade.init() function NPCTrade.init()
cacheItems = {} cacheItems = {}
cacheGoods = {} cacheGoods = {}
npcWindow = displayUI('npctrade.otui') npcWindow = displayUI('npctrade.otui')
npcWindow:setVisible(false) npcWindow:setVisible(false)
itemsPanel = npcWindow:recursiveGetChildById('itemsPanel') itemsPanel = npcWindow:recursiveGetChildById('itemsPanel')
buyTab = npcWindow:getChildById('buyTab') buyTab = npcWindow:getChildById('buyTab')
sellTab = npcWindow:getChildById('sellTab') sellTab = npcWindow:getChildById('sellTab')
searchText = npcWindow:getChildById('searchText') searchText = npcWindow:getChildById('searchText')
setupPanel = npcWindow:recursiveGetChildById('setupPanel') setupPanel = npcWindow:recursiveGetChildById('setupPanel')
quantityLabel = setupPanel:getChildById('quantity') quantityLabel = setupPanel:getChildById('quantity')
quantityScroll = setupPanel:getChildById('quantityScroll') quantityScroll = setupPanel:getChildById('quantityScroll')
@ -51,13 +51,13 @@ function NPCTrade.init()
weightLabel = setupPanel:getChildById('weight') weightLabel = setupPanel:getChildById('weight')
capacityLabel = setupPanel:getChildById('capacity') capacityLabel = setupPanel:getChildById('capacity')
setupButton = setupPanel:getChildById('setupButton') setupButton = setupPanel:getChildById('setupButton')
radioTabs = RadioGroup.create() radioTabs = RadioGroup.create()
radioTabs:addWidget(buyTab) radioTabs:addWidget(buyTab)
radioTabs:addWidget(sellTab) radioTabs:addWidget(sellTab)
radioTabs:selectWidget(buyTab) radioTabs:selectWidget(buyTab)
radioTabs.onSelectionChange = NPCTrade.setList radioTabs.onSelectionChange = NPCTrade.setList
connect(g_game, { onGameEnd = NPCTrade.hide, connect(g_game, { onGameEnd = NPCTrade.hide,
onOpenNpcTrade = NPCTrade.onOpenNpcTrade, onOpenNpcTrade = NPCTrade.onOpenNpcTrade,
onPlayerGoods = NPCTrade.onPlayerGoods, onPlayerGoods = NPCTrade.onPlayerGoods,
@ -73,7 +73,7 @@ function NPCTrade.terminate()
buyButton = nil buyButton = nil
sellButton = nil sellButton = nil
searchText = nil searchText = nil
setupPanel = nil setupPanel = nil
quantityLabel = nil quantityLabel = nil
quantityScroll = nil quantityScroll = nil
@ -84,14 +84,18 @@ function NPCTrade.terminate()
capacityLabel = nil capacityLabel = nil
offerSelected = nil offerSelected = nil
setupButton = nil setupButton = nil
cacheItems = nil cacheItems = nil
cacheGoods = nil cacheGoods = nil
buyTab = nil
sellTab = nil
disconnect(g_game, { onGameEnd = NPCTrade.hide, disconnect(g_game, { onGameEnd = NPCTrade.hide,
onOpenNpcTrade = NPCTrade.onOpenNpcTrade, onOpenNpcTrade = NPCTrade.onOpenNpcTrade,
onPlayerGoods = NPCTrade.onPlayerGoods, onPlayerGoods = NPCTrade.onPlayerGoods,
onCloseNpcTrade = NPCTrade.onCloseNpcTrade } ) onCloseNpcTrade = NPCTrade.onCloseNpcTrade } )
NPCTrade = nil
end end
-- private functions -- private functions
@ -106,12 +110,12 @@ function NPCTrade.hide()
npcWindow:hide() npcWindow:hide()
end end
function NPCTrade.setList(radioTabs, selected, deselected) function NPCTrade.setList(radioTabs, selected, deselected)
setupButton:setText(selected:getText()) setupButton:setText(selected:getText())
selected:setOn(true) selected:setOn(true)
deselected:setOn(false) deselected:setOn(false)
NPCTrade.createItemsOnPanel() NPCTrade.createItemsOnPanel()
NPCTrade.resetSetup() NPCTrade.resetSetup()
NPCTrade.refreshItemsPanel() NPCTrade.refreshItemsPanel()
NPCTrade.refreshFilters() NPCTrade.refreshFilters()
@ -140,7 +144,7 @@ function NPCTrade.updateSetup()
if cacheGoods[offerSelected[1]:getId()] then -- list might be empty. if cacheGoods[offerSelected[1]:getId()] then -- list might be empty.
quantityScroll:setMaximum(math.max(0, math.min(100, cacheGoods[offerSelected[1]:getId()]))) quantityScroll:setMaximum(math.max(0, math.min(100, cacheGoods[offerSelected[1]:getId()])))
end end
end end
else else
NPCTrade.resetSetup() NPCTrade.resetSetup()
end end
@ -174,11 +178,11 @@ function NPCTrade.setItem(widget)
weightLabel:setText(string.format('%.2f', offer[3]/100) .. ' ' .. WEIGHT_UNIT) weightLabel:setText(string.format('%.2f', offer[3]/100) .. ' ' .. WEIGHT_UNIT)
priceLabel:setText(price .. ' ' .. CURRENCY) priceLabel:setText(price .. ' ' .. CURRENCY)
capacityLabel:setText(string.format('%.2f', freeCapacity) .. ' ' .. WEIGHT_UNIT) capacityLabel:setText(string.format('%.2f', freeCapacity) .. ' ' .. WEIGHT_UNIT)
quantityLabel:setText(1) quantityLabel:setText(1)
quantityScroll:setValue(1) quantityScroll:setValue(1)
NPCTrade.updateSetup() NPCTrade.updateSetup()
setupPanel:enable() setupPanel:enable()
end end
@ -186,7 +190,7 @@ function NPCTrade.setQuantity(quantity)
if quantityLabel and offerSelected then if quantityLabel and offerSelected then
local price = NPCTrade.getOfferPrice(offerSelected) local price = NPCTrade.getOfferPrice(offerSelected)
quantityLabel:setText(quantity) quantityLabel:setText(quantity)
weightLabel:setText(string.format('%.2f', offerSelected[3]*quantity/100) .. ' ' .. WEIGHT_UNIT) weightLabel:setText(string.format('%.2f', offerSelected[3]*quantity/100) .. ' ' .. WEIGHT_UNIT)
priceLabel:setText(price .. ' ' .. CURRENCY) priceLabel:setText(price .. ' ' .. CURRENCY)
end end
end end
@ -208,14 +212,14 @@ function NPCTrade.onOpenNpcTrade(items)
-- item[5] = sellPrice -- item[5] = sellPrice
cacheItems = items cacheItems = items
NPCTrade.createItemsOnPanel() NPCTrade.createItemsOnPanel()
NPCTrade.show() NPCTrade.show()
end end
function NPCTrade.switchBuyWithBackpack() function NPCTrade.switchBuyWithBackpack()
buyWithBackpack = not buyWithBackpack buyWithBackpack = not buyWithBackpack
if offerSelected then if offerSelected then
priceLabel:setText(NPCTrade.getOfferPrice(offerSelected) .. ' ' .. CURRENCY) priceLabel:setText(NPCTrade.getOfferPrice(offerSelected) .. ' ' .. CURRENCY)
end end
@ -238,12 +242,12 @@ function NPCTrade.itemPopup(self, mousePosition, mouseButton)
end end
end end
function NPCTrade.createItemsOnPanel() function NPCTrade.createItemsOnPanel()
local layout = itemsPanel:getLayout() local layout = itemsPanel:getLayout()
layout:disableUpdates() layout:disableUpdates()
NPCTrade.resetSetup() NPCTrade.resetSetup()
offerSelected = nil offerSelected = nil
itemsPanel:destroyChildren() itemsPanel:destroyChildren()
@ -251,7 +255,7 @@ function NPCTrade.createItemsOnPanel()
radioItems:destroy() radioItems:destroy()
end end
radioItems = RadioGroup.create() radioItems = RadioGroup.create()
for i, v in pairs(cacheItems) do for i, v in pairs(cacheItems) do
local price = NPCTrade.getOfferPrice(v) local price = NPCTrade.getOfferPrice(v)
if price > 0 then if price > 0 then
@ -260,28 +264,28 @@ function NPCTrade.createItemsOnPanel()
itemBox:getChildById('item'):setItem(v[1]) itemBox:getChildById('item'):setItem(v[1])
itemBox:getChildById('nameLabel'):setText(v[2]) itemBox:getChildById('nameLabel'):setText(v[2])
itemBox:getChildById('weightLabel'):setText(string.format('%.2f', v[3]/100) .. ' ' .. WEIGHT_UNIT) itemBox:getChildById('weightLabel'):setText(string.format('%.2f', v[3]/100) .. ' ' .. WEIGHT_UNIT)
itemBox:getChildById('priceLabel'):setText(price .. ' ' .. CURRENCY) itemBox:getChildById('priceLabel'):setText(price .. ' ' .. CURRENCY)
itemBox.onMouseRelease = NPCTrade.itemPopup itemBox.onMouseRelease = NPCTrade.itemPopup
itemBox:getChildById('item').onMouseRelease = function (self, mousePosition, mouseButton) NPCTrade.itemPopup(itemBox, mousePosition, mouseButton) end itemBox:getChildById('item').onMouseRelease = function (self, mousePosition, mouseButton) NPCTrade.itemPopup(itemBox, mousePosition, mouseButton) end
radioItems:addWidget(itemBox) radioItems:addWidget(itemBox)
end end
end end
layout:enableUpdates() layout:enableUpdates()
layout:update() layout:update()
end end
function NPCTrade.extraFilters(widget, showOnlyHolding) function NPCTrade.extraFilters(widget, showOnlyHolding)
if setupButton:getText() == tr('Sell') then if setupButton:getText() == tr('Sell') then
if not showOnlyHolding or cacheGoods[widget.offer[1]:getId()] then if not showOnlyHolding or cacheGoods[widget.offer[1]:getId()] then
return true return true
else else
return false return false
end end
end end
return true return true
end end
@ -332,16 +336,16 @@ end
function NPCTrade.onPlayerGoods(money, goods) function NPCTrade.onPlayerGoods(money, goods)
moneyGoods = money moneyGoods = money
moneyLabel:setText(money .. ' ' .. CURRENCY) moneyLabel:setText(money .. ' ' .. CURRENCY)
local freeCapacity = g_game.getLocalPlayer():getFreeCapacity() local freeCapacity = g_game.getLocalPlayer():getFreeCapacity()
capacityLabel:setText(string.format('%.2f', freeCapacity) .. ' ' .. WEIGHT_UNIT) capacityLabel:setText(string.format('%.2f', freeCapacity) .. ' ' .. WEIGHT_UNIT)
cacheGoods = {} cacheGoods = {}
for i,v in pairs(goods) do for i,v in pairs(goods) do
cacheGoods[v[1]:getId()] = v[2] cacheGoods[v[1]:getId()] = v[2]
end end
NPCTrade.refreshItemsPanel() NPCTrade.refreshItemsPanel()
NPCTrade.updateSetup() NPCTrade.updateSetup()
end end

View File

@ -126,6 +126,8 @@ function Outfit.terminate()
disconnect(g_game, { onOpenOutfitWindow = Outfit.create, disconnect(g_game, { onOpenOutfitWindow = Outfit.create,
onGameEnd = Outfit.destroy }) onGameEnd = Outfit.destroy })
Outfit.destroy() Outfit.destroy()
Outfit = nil
end end
function Outfit.create(creature, outfitList) function Outfit.create(creature, outfitList)

View File

@ -4,6 +4,9 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependencies:
- game
@onLoad: | @onLoad: |
dofile 'outfit' dofile 'outfit'
Outfit.init() Outfit.init()

View File

@ -59,6 +59,8 @@ function Skills.terminate()
skillsButton = nil skillsButton = nil
skillsWindow:destroy() skillsWindow:destroy()
skillsWindow = nil skillsWindow = nil
Skills = nil
end end
function Skills.toggle() function Skills.toggle()

View File

@ -4,6 +4,9 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependencies:
- game
@onLoad: | @onLoad: |
dofile 'skills' dofile 'skills'
Skills.init() Skills.init()

View File

@ -131,5 +131,5 @@ end
function TextMessage.displayDeadMessage() function TextMessage.displayDeadMessage()
local advanceLabel = GameInterface.getMapPanel():recursiveGetChildById('centerAdvance') local advanceLabel = GameInterface.getMapPanel():recursiveGetChildById('centerAdvance')
if advanceLabel:isVisible() then return end if advanceLabel:isVisible() then return end
TextMessage.displayEventAdvance('You are dead.') TextMessage.displayEventAdvance(tr('You are dead.'))
end end

View File

@ -4,7 +4,7 @@ Module
author: OTClient team author: OTClient team
website: https://github.com/edubart/otclient website: https://github.com/edubart/otclient
dependecies: dependencies:
- game - game
@onLoad: | @onLoad: |

View File

@ -26,6 +26,8 @@ function VipList.terminate()
vipWindow = nil vipWindow = nil
vipButton:destroy() vipButton:destroy()
vipButton = nil vipButton = nil
VipList = nil
end end
function VipList.clear() function VipList.clear()

View File

@ -8,5 +8,5 @@ Module
dofile 'viplist' dofile 'viplist'
VipList.init() VipList.init()
@onUnload: @onUnload: |
VipList.terminate() VipList.terminate()

View File

@ -281,13 +281,15 @@ void UIManager::onWidgetDestroy(const UIWidgetPtr& widget)
checkEvent = g_eventDispatcher.scheduleEvent([] { checkEvent = g_eventDispatcher.scheduleEvent([] {
g_lua.collectGarbage(); g_lua.collectGarbage();
g_eventDispatcher.addEvent([] { UIWidgetList backupList = destroyedWidgets;
destroyedWidgets.clear();
g_eventDispatcher.scheduleEvent([backupList] {
g_lua.collectGarbage(); g_lua.collectGarbage();
for(const UIWidgetPtr& widget : destroyedWidgets) { for(const UIWidgetPtr& widget : backupList) {
if(widget->getUseCount() != 1) if(widget->getUseCount() != 1)
logWarning("widget '", widget->getId(), "' destroyed but still have ", widget->getUseCount()-1, " reference(s) left"); logWarning("widget '", widget->getId(), "' destroyed but still have ", widget->getUseCount()-1, " reference(s) left");
} }
}); }, 1);
}, 1000); }, 1000);
#endif #endif
} }