SqlDB, OnGetText, SIGSEGV lazarus / 16-Databases ---------------------------------------------------------------------- tintinux · 2011-04-11 09:13 Hi I connect to a MS-Access "database" with Lazarus 0.9.30/Windows, SqlDb,  TODBCConnection and TSqlTransaction. If I assign OnGetText event in a TSqlQuery Field, I get at runtime a SIGSEGV when the event handler is called. Even if nothing, or a mere constant assignment, is in the event handler. I was not able to find the error using the debugger. I have been using succesfully OnGetText with ZeosLib components, but I never used before SqlDB components. Anyone knows what could be the reason ?  Was successful in this area ? Regards Tintinux ---------------------------------------------------------------------- Lacak2 · 2011-04-12 05:36 Can you post here some test program, example, how-to reproduce problem ? ---------------------------------------------------------------------- tintinux · 2011-04-12 08:11 Hi Thanks for your help. I have attached a sample program. You must provide a MS-ACCESS database named test.mdb There is a button on the form to delete, create and populate a table named test When the OnGetText event is attached to the field Name, to display uppercase in this example, I get the SIGSEGV error. If you have any issue or can't reproduce, just tell ! Regards Tintinux ---------------------------------------------------------------------- Lacak2 · 2011-04-12 09:56 Try this: put into unit UnitMenu after {$mode objfpc} this: {$H+} ---------------------------------------------------------------------- tintinux · 2011-04-12 11:41 Hi, Many thanks, it works fine with {$H+} Don't you think this could be avoided by some change in a next release ? In this case, a bug report should be created. Do you want to do it, or me ? Regards Tintinux ---------------------------------------------------------------------- Lacak2 · 2011-04-12 12:33 I am not sure if it is a bug , but I agree, that it leads to very wrong results. Problem is in fact, that without {$H+} is string equal to shortstring and with {$H+} is string equal to ansistring type. AV can be avoided also without adding {$H+}, but you must change definition of method:     procedure SQLQuery1nameGetText(Sender: TField; var aText: ansistring;       DisplayText: Boolean);  So you can report it as bug, but I am afraid, that it will be closed with "Won't fix"  ... but you can at least try ---------------------------------------------------------------------- marcov · 2011-04-12 13:48 I'd say file a bug, and name this as a reason why "use ansistrings" should be on by default in the "new unit" menu. The problem is that properties are not typed. If you would do this in code, you'd get a compilation failure.