Avoid overflow items remaining in memory and causing a crash
This commit is contained in:
parent
7daead0d11
commit
2a3a280793
@ -3378,8 +3378,13 @@ void PlayerItemList::DestroyItem(int16 index){
|
||||
if(items.count(item->details.inv_slot_id) > 0 && items[item->details.inv_slot_id][item->details.appearance_type].count(item->details.slot_id) > 0)
|
||||
items[item->details.inv_slot_id][item->details.appearance_type].erase(item->details.slot_id);
|
||||
indexed_items[index] = 0;
|
||||
|
||||
|
||||
vector<Item*>::iterator itr = std::find(overflowItems.begin(), overflowItems.end(), item);
|
||||
if(itr != overflowItems.end()) {
|
||||
overflowItems.erase(itr); // avoid a dead ptr
|
||||
}
|
||||
lua_interface->SetLuaUserDataStale(item);
|
||||
|
||||
safe_delete(item);
|
||||
}
|
||||
MPlayerItems.releasewritelock(__FUNCTION__, __LINE__);
|
||||
|
@ -2146,9 +2146,14 @@ void Player::UpdateInventory(int32 bag_id) {
|
||||
|
||||
}
|
||||
EQ2Packet* Player::MoveInventoryItem(sint32 to_bag_id, int16 from_index, int8 new_slot, int8 charges, int8 appearance_type, bool* item_deleted, int16 version) {
|
||||
|
||||
Item* item = item_list.GetItemFromIndex(from_index);
|
||||
bool isOverflow = ((item != nullptr) && (item->details.inv_slot_id == -2));
|
||||
int8 result = item_list.MoveItem(to_bag_id, from_index, new_slot, appearance_type, charges);
|
||||
if (result == 1) {
|
||||
if(isOverflow && item->details.inv_slot_id != -2) {
|
||||
item_list.RemoveOverflowItem(item);
|
||||
}
|
||||
if (item) {
|
||||
if (!item->needs_deletion)
|
||||
item->save_needed = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user