AV on TCustomSQLQuery.InternalInitFieldDefs
Original Reporter info from Mantis: zgabrovski
-
Reporter name: Zdravko Gabrovski
Original Reporter info from Mantis: zgabrovski
- Reporter name: Zdravko Gabrovski
Description:
When I try to add a fields to a TSQLQuery object, that is NOT OPEN(Active=false) inside Lazarus IDE with fields collection editor (see attached .png files), I received a AV exception.
This cause IDE to crash and need to restart. The Only way to add a fields is to check "Actibe=true" before start a collection editor.
After deep investigation and debug I found, that the problem comes from InternalInitFieldDefs method (sqldb.pp, line 3063), because the funcion call result "Cursor" called at line 3070 SQLConnection.AddFieldDefs(Cursor,FieldDefs); return an empty value (nil).
It takes a TCustomSQLStatement FStatement Cursor variable, which is not initializied if TSQQuery obkect is not activated (Active=true).
I did the following fix:
At line 3070 in sqldb.pp I insert a code<br/>
if Not Assigned (Cursor) Then
FStatement.Prepare;
Which prepares a statment and allocate cursor.
This avoid AV message and IDE crash.
Steps to reproduce:
As described above.
To simulate, please use attached project, use the "Test Update List" button.
Please, point a TIBconnection to your favor firebird server and fb database.
Mantis conversion info:
- Mantis ID: 36089
- OS: all
- OS Build: all
- Build: trunk
- Platform: all
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 43037 (#9396decb)
- Target version: 4.0.0