Access Violation related to IndexDefs
Original Reporter info from Mantis: pgimeno
-
Reporter name: Pedro Gimeno
Original Reporter info from Mantis: pgimeno
- Reporter name: Pedro Gimeno
Description:
I was getting access violations in Lazarus when doing certain database component operations. I reported it as issue #37870 and after bisection and further investigation, it became clear that the issue was introduced in FPC commit r38353 and that it isn't related to Lazarus. I was asked to report it in the FPC project, so here we go.
This problem is reproducible in any version starting at r38353. It is not reproducible in r38352 or earlier. Unfortunately, the diff of commit r38353 is about 1700 lines, and is quite complex.
Steps to reproduce:
- Create an sqlite database, e.g. sqlite3 /tmp/database.sqlite "CREATE TABLE T(F INTEGER);"
- Run the following program:
{$mode objfpc}{$H+} uses db, sqldb, sqlite3conn; var Conn: TSQLite3Connection; Tran: TSQLTransaction; SQLQ: TSQLQuery; begin Conn := TSQLite3Connection.Create(nil); Conn.Name := 'Conn'; Conn.DatabaseName := '/tmp/database.sqlite'; Tran := TSQLTransaction.Create(nil); Tran.Name := 'Tran'; Tran.Database := Conn; SQLQ := TSQLQuery.Create(nil); SQLQ.Name := 'SQLQ'; SQLQ.Database := Conn; SQLQ.SQL.Text := 'SELECT * FROM T'; SQLQ.Open; SQLQ.IndexDefs.Add('IdxSomethingSomethingBlah', '', []); SQLQ.Close; // crash happens here end.
Output is:
An unhandled exception occurred at $00000000004E5012: EAccessViolation: Access violation $00000000004E5012
Mantis conversion info:
- Mantis ID: 37915
- OS: Linux
- Build: 47066
- Platform: x86_64
- Version: 3.3.1
- Monitored by: » Heranuko (Heranuko)