I've googled a bit and found out this error has something to do with segment fault or memory leaks, but I have no idea which part of the code that cause this. Can anyone point out?
None of these function leads to delete or delete[], btw;
for(int i = 0; i< 5; i++) for(int j = 0; j< 5; j++)
{
if(itemslot[j]->button->Intersects(base))
{
ItemSlot slot = *itemslot[j];
itemslot[j]->stack = highlight->stack;
itemslot[j]->item = highlight->item;
stringstream s, s2;
s << itemslot[j]->stack;
itemslot[j]->button->SetText(s.str());
itemslot[j]->buttondefaultimage = highlight->buttondefaultimage;
highlight->stack = slot.stack;
highlight->item = slot.item;
s2 << slot.stack;
highlight->button->SetText((slot.stack > 0)? s2.str() : "");
highlight->buttondefaultimage = slot.buttondefaultimage;
for(int k = 0; k< 3; k++)
{
Image *img = itemslot[j]->button->GetImage(k);
itemslot[j]->button->SetImage(k, highlight->button->GetImage(k));
highlight->button->SetImage(k, img);
}
highlight = null;
break;
}
}