located serious bug and have solution

There is a serious bug in the latet QB.

In the following proc:

procedure TOQBTable._CloseBtn(Sender: TObject);
begin

TOQBArea(Parent).UnlinkTable(Self);
TOQBForm(GetParentForm(Self)).QBGrid.RemoveColumn4Tbl(FTableName);
Parent.RemoveControl(Self);
free;
end;

The free is causing a access violation because you are freeing the container of the close button while you are still in the close buttons close event.

I am not sure what would be the best way for a permenant fix, but I came up with this

procedure TOQBTable._CloseBtn(Sender: TObject);
begin
try
TOQBArea(Parent).UnlinkTable(Self);
TOQBForm(GetParentForm(Self)).QBGrid.RemoveColumn4Tbl(FTableName);
Parent.RemoveControl(Self);
postmessage(mainform.Handle,DM_CLOSETABLE,integer(self),integer(self));
except
on e:exception do
showmessage(e.Message);
end;

end;

I send the integer value of the toqbtable via post message to the main form where I free it and then the AV is gone.

I am not sure how to solve this without using a windows message.

Any ideas?

Thanks,

snorkel

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.