Hello,
The following C++ code leads to an access violation
void __fastcall TForm2::AdvCardList1CardItemURLClick(TObject *Sender, int CardIndex,
int ItemIndex, UnicodeString URL, bool &Default)
{
AdvCardList1->BeginUpdate();
AdvCardList1->Cards->Delete(CardIndex);
AdvCardList1->EndUpdate();
}
seems like the TCustomAdvCardList.click event hasn't finished.
usually, to solve this, i put the delete operation in a window-message:
PostMessage(Form2->Handle, WM_DELETE_CARD, CardIndex, 0);
MESSAGE __fastcall TForm2::HandleDeleteCard(TMessage &Msg)
{
AdvCardList1->Cards->Delete(Msg.WParam);
}
but it doesn't help in this case either, the access violation then happens later at TCustomAdvCardList.ItemAtXY
How can I prevent this?