fedorax wrote:
Selon Joost van der Sluis <[EMAIL PROTECTED]>:

On Sat, 2007-05-26 at 15:00 +0200, fedorax wrote:

I've a strange bug. In this fonction ( Which was worked perfectly from few
months an never chage ).
--------------------------
procedure TFunc_Sql.List_TablesSelectionChange(Sender: TObject; User:
boolean);
begin
  If List_Tables.ItemIndex<0 then List_Tables.ItemIndex:=0;
  T_Name:=List_Tables.Items[List_Tables.ItemIndex]; // The selected table
name
  If SQLQuery.Active Then SQLQuery.Close; // Close the precedent query
  SQLQuery.SQL.Text:='Select * From '+ T_Name;
  SQLQuery.Open;  //Open to list in DbGrid
end;
--------------------------
The line   "If SQLQuery.Active Then SQLQuery.Close;" cause an access
violation
and close the application without visible cause.
My guess is that you've destroyed/freed SQLQuery somewhere before this
code is called.

Joost

Not that, the SQLComponent is put on the form and no instruction exist for free
it. Is it possible that a bug free a component without programmer ask to it ?

A component is freed when its Owner is destroyed (in this case the form), so as 
long as you don't free the form or SQLQuery by hand, all should be ok.

To track the cause of the exception, you probably need to get a stacktrace; 
e.g. use GDB or Lazarus itself. Hint for GDB:

break FPC_RAISEEXCEPTION
run
...
bt

You can insert ShowMessage of DebugLn statements to find out what your 
application is doing.

Regards,

Bram

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to