[DiscordArchive] why is there a thread handling mail expirations?
[DiscordArchive] why is there a thread handling mail expirations?
Archived author: andriuspel • Posted: 2024-11-11T12:21:53.621000+00:00
Original source
unless for cases where i need to intentionally delete item and effect original
Archived author: andriuspel • Posted: 2024-11-11T12:23:21.245000+00:00
Original source
```c
auto& item = items.at(0):
item.reset(); // passing null also works
// or just
items.at(0).reset();
``` in this example I would deallocate main container, but rest references still gonna be alive till their code algorythm end
Archived author: andriuspel • Posted: 2024-11-11T12:25:42.964000+00:00
Original source
at base my plan is - for most calls to ensure that extra shared_ptr reference is created to ensure pointer lifetime
Archived author: andriuspel • Posted: 2024-11-11T12:26:43.762000+00:00
Original source
these references will not leak or increase memory usage (except atomic counter, which by default is size_t in shared_ptr, may will increment/decrement)
Archived author: walkline • Posted: 2024-11-11T12:33:40.413000+00:00
Original source
Looks to me like a good change
but anyways this pr review will take a lot of time...
but well, i'm not in hurry
unless more laravel work will appear xD
Archived author: andriuspel • Posted: 2024-11-11T12:36:45.978000+00:00
Original source
i will make same change for trinitycore too
but anyways this pr review will take a lot of time...
but well, i'm not in hurry
unless more laravel work will appear xD
hared_ptr<Item> item = m_myItems[i])Archived author: andriuspel • Posted: 2024-11-11T14:08:24.407000+00:00
Original source
minor example, in this example i made extra reference (increments shared_ptr counter),
old: ```c
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (!m_items[i])
continue;
m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
}``` new: ```c
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (std:
hared_ptr<Item> item = m_myItems[i])
item->BuildCreateUpdateBlockForPlayer(data, target);
}```
Archived author: andriuspel • Posted: 2024-11-11T14:09:41.744000+00:00
Original source
```c
for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
{
auto item = m_myItems[i];
if (item == nullptr)
{
continue;
}
ItemTemplate const* proto = item->GetTemplate();
if (proto == nullptr)
continue;
// item set bonuses not dependent from item broken state
if (proto->ItemSet)
RemoveItemsSetItem(this, proto);
if (item->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
continue;
ApplyItemEquipSpell(item.get(), false);
ApplyEnchantment(item.get(), false);
}```
Archived author: andriuspel • Posted: 2024-11-11T14:11:08.811000+00:00
Original source
so if m_myItems[i] object is removed, referenced references still gonna be valid till code end