FPC 3.1.1 / Lazarus 1.7 : crash when opening a TSQLQuery lazarus / 16-Databases ---------------------------------------------------------------------- swierzbicki · 2016-11-16 08:39 Hello, My project is crashing with an External:SIGSEGV error. This happens when opening my TSQLQuery. The same code used to works with FPC 3.0 and Lazarus 1.6. Any clue ? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function GetSQLiteuser_version(ADatabaseName: String): integer;var  ConnectionLocale: TSQLite3Connection;  TransactionLocale: TSQLTransaction;   Qry: TSQLQuery; begin  Result := 0;  if not FileExists(ADatabaseName) then    Exit;   ConnectionLocale := TSQLite3Connection.Create(nil);  TransactionLocale := TSQLTransaction.Create(nil);  Qry := TSQLQuery.Create(nil);  try     ConnectionLocale.Transaction := TransactionLocale;    TransactionLocale.Database := ConnectionLocale;    ConnectionLocale.DatabaseName := ADatabaseName;    Qry.Database := ConnectionLocale;    Qry.Transaction := ConnectionLocale.Transaction;        ConnectionLocale.open;      sqlite3_busy_timeout(ConnectionLocale.Handle, 250);         if ConnectionLocale.Connected then      begin        Qry.SQL.Text := 'Pragma User_version';        Qry.open; // <---- Crash        Result := Qry.Fields[0].AsInteger;        if TransactionLocale.Active then        TransactionLocale.Commit;        Qry.close;        ConnectionLocale.close;      end;   finally      Qry.Free;      TransactionLocale.Free;      ConnectionLocale.Free;  end;end;        Here is the call stack Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i #0 ?? at :0#1 SQLDB$_$TCUSTOMSQLQUERY_$__$$_INTERNALINITFIELDDEFS at :0#2 SQLDB$_$TCUSTOMSQLQUERY_$__$$_INTERNALOPEN at :0#3 DB$_$TDATASET_$__$$_DOINTERNALOPEN at :0#4 DB$_$TDATASET_$__$$_OPENCURSOR$BOOLEAN at :0#5 DB$_$TDATASET_$__$$_SETACTIVE$BOOLEAN at :0#6 SQLDB$_$TCUSTOMSQLQUERY_$__$$_SETACTIVE$BOOLEAN at :0#7 DB$_$TDATASET_$__$$_OPEN at :0#8 GETSQLITEUSER_VERSION(0x18fe6ec 'C:\U sers\Stephane.Wierzbicki\Documents\Embarcadero\Studio\Projets\Dodo\Ges tion Stock\Output\i386-win32\dodo.db3') at C:\vcl\Common_Lib\common_db.pas:916#9 TDTMMAIN__SETDEFAULTPREFERENCES() at .\Sources\dmmain.pas:475#10 TDTMMAIN__DATAMODULECREATE(0x64b8528, ) at .\Sources\dmmain.pas:642#11 CLASSES$_$TDATAMODULE_$__$$_DOCREATE at :0#12 CLASSES$_$TDATAMODULE_$__$$_AFTERCONSTRUCTION at :0#13 CLASSES$_$TDATAMODULE_$__$$_CREATE$TCOMPONENT$$TDATAMODULE at :0#14 TAPPLICATION__CREATEFORM(, , ) at .\include\application.inc:2190#15 main at Gestion_Stock.lpr:91 Ps : http://bugs.freepascal.org/view.php?id=30935 ---------------------------------------------------------------------- LacaK · 2016-11-22 18:02 Reply copied from bugtracker: QuoteWhich version of SQLite3.dll do you use ? (downloaded or self compiled?) Probably in your version is missing API function sqlite3_column_origin_name() ---------------------------------------------------------------------- swierzbicki · 2016-11-24 10:04 I've just checked. My win32 project is calling C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\sqlite3.dll When compiled with fpc 3.0 / lazarus 16.2 : ok When compiled with fpc 3.1.1 / lazarus 1.7 / new pascal : crash ---------------------------------------------------------------------- Thaddy · 2016-11-24 12:01 NewPascal is supposed to be supported by the people behind NewPascal. It is a fork. Support for NewPascal is highly unlikely to have a place on this forum. We can only support Lazarus and FreePascal. Not some clone that is far from finished and uses code that is insufficiently tested. ---------------------------------------------------------------------- hnb · 2016-11-24 13:15 Quote from: Thaddy on November 24, 2016, 01:01:45 pmNewPascal is supposed to be supported by the people behind NewPascal. It is a fork. Support for NewPascal is highly unlikely to have a place on this forum. We can only support Lazarus and FreePascal. Not some clone that is far from finished and uses code that is insufficiently tested. NewPascal is pure Lazarus trunk and tuned FPC trunk (also for mORMot). NewPascal is tested with full FPC test suite. Anyway NewPascal/mORMot forum might be better place for asking about NewPascal. NewPascal is not "some clone" but important place where was born rtl-generics (FreeSparta roots, NewPascal is successor of FreeSparta), management operators and more. NewPascal has different philosophy than "old fashioned" original FPC with slow progress (which for someone could be better choice). Alfred said on mailing list: QuoteThis is exactly why NewPascal is here ! Have an idea. Implement. Make public. perfect:=false; while (NOT perfect) Use; Get feedback; Correct mistakes; Test; if ok then perfect:=true; end; All in a cycle of moments like hours or days. be positive ---------------------------------------------------------------------- Thaddy · 2016-11-24 14:29 You know I support your efforts Just don't fall into traps that leave those efforts dangling as a lost child all over the internet And have a proper release management in place. The Stones wrote a song about that: You can't always get what you want.... Also contains the line: but if you try sometime, you might find, you get what you need. ---------------------------------------------------------------------- swierzbicki · 2016-11-24 16:17 QuoteNewPascal is supposed to be supported by the people behind NewPascal. It is a fork. Support for NewPascal is highly unlikely to have a place on this forum. We can only support Lazarus and FreePascal. Not some clone that is far from finished and uses code that is insufficiently tested. Well, isn't  NewPascal a Lazarus trunk and a enhanced FPC trunk ? For the record, I'm getting the very same issue with the FPC and Lazarus trunk ... ---------------------------------------------------------------------- hnb · 2016-11-24 16:28 Quote from: swierzbicki on November 24, 2016, 05:17:34 pmWell, isn't  NewPascal a Lazarus trunk and a enhanced FPC trunk ? yes it is ---------------------------------------------------------------------- JuhaManninen · 2016-11-24 19:22 Quote from: Thaddy on November 24, 2016, 01:01:45 pmNewPascal is supposed to be supported by the people behind NewPascal. It is a fork. Support for NewPascal is highly unlikely to have a place on this forum. We can only support Lazarus and FreePascal. Not some clone that is far from finished and uses code that is insufficiently tested. The question was purely about FPC, Lazarus and TSQLQuery. Why did you bring up NewPascal here? ---------------------------------------------------------------------- hnb · 2016-11-24 21:27 About topic: FPC trunk has headers for SQLite 3.14.2. With Delphi 10.1 Berlin in bin directory is released SQLite 3.8.10.2 (few versions behind). Try to use newer SQLite3 library. ---------------------------------------------------------------------- swierzbicki · 2016-11-25 07:58 QuoteAbout topic: FPC trunk has headers for SQLite 3.14.2. With Delphi 10.1 Berlin in bin directory is released SQLite 3.8.10.2 (few versions behind). Try to use newer SQLite3 library. Thank you for your clear answer. This was indeed the problem. Changing the win32 dll did the trick. I'll now check this on the wince side (could a be a different story) ---------------------------------------------------------------------- LacaK · 2016-11-25 11:40 As I reported in mantis: QuoteCan't reproduce with TRUNK version of fcl-db, with attached bug30935 program, SQLite 3.11.0 under Win32 downloaded from https://sqlite.org/2016/sqlite-dll-win32-x86-3110000.zipIn my case TRUNK works with 3.8.10.2, 3.11.0, 3.14.2 ... so I do not think, that SQLite DLL version matters (if not very old) ---------------------------------------------------------------------- Kurt · 2016-12-03 04:11 I've noticed that in recent versions FPC/Lazarus that it's possible to set a link loop between TSQLQuery and TDataSource.  If you point your TSQLQuery's datasource property at a TDataSource and then point TDataSource's DataSet property back to the TSQLQuery then it will crash at different points.  I seem to remember that setting that loop used to trigger an error. All those components link together in, frankly, a completely incomprehensible way, so it's easy to get to setting all the interrelationships that are needed and put in one too many.