Forum > Databases
Possible bug on TDBEDIT on Mint - Error, SIGSEGV
incendio:
Hi guys,
I have this code (Lazarus 2.2.2 for Windows 32bit, IBX 2.5.0.9999, Firebird 3)
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TInpInOtFrm.DtTbl1BeforeEdit(DataSet: TDataSet);begin if not(DM.Dt1_Ok2Edit(DtTbl1)) then Abort();end; function TDM.Dt1_Ok2Edit(DtTbl1:TIBDataset) : boolean;begin if(DataIsLock) and not(DtTbl1.FieldByName('lck_by').IsNull) then Result := false else Result := true;end; Those codes runs perfectly fine on Windows OS.
When compiled on Linux Mint, with Lazarus 2.2.0, same version of IBX, the Abort() method raised an error : SIGSEGV.
But, the same method on different event didn't raised an error.
Here the code with Abort() method but still fine
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TInpInOtFrm.DtTbl1BeforePost(DataSet: TDataSet);begin if not (DtTbl1TRS_DT.IsNull) then begin if not (DM.IsTrsDtValid(DtTbl1TRS_DT.AsDateTime)) then begin utils.Error('Not valid date!'); TrsDt.SetFocus(); Abort(); end; end;end; What's wrong here?
rvk:
What should Abort do??
https://www.freepascal.org/docs-html/rtl/sysutils/abort.html
It raises an exception.
Did you handle the exception correctly someplace else?
BTW. What is DM?
Is that your instance of TDM.
It might be better then to remove the DM. or use Dataset.Dt1_Ok2Edit.
Abort forces an exception.
Usually that means an operation is halted.
It might not be the best method to do this in a Lazarus application because you don't know where the exception ends up.
incendio:
--- Quote from: rvk on November 17, 2023, 04:45:50 am ---What should Abort do??
https://www.freepascal.org/docs-html/rtl/sysutils/abort.html
It raises an exception.
Did you handle the exception correctly someplace else?
BTW. What is DM?
Is that your instance of TDM.
It might be better then to remove the DM. or use Dataset.Dt1_Ok2Edit.
--- End quote ---
1. Abort -> cancel editing, no handle exception made, should I? On Windows it is OK, also on Linux it's OK, see edited topic on post # 1
2. DM is a name of a datamodule
rvk:
PS. On the first you do it in beforeEdit.
On the second in beforePost.
They are different .
--- Quote from: incendio on November 17, 2023, 04:50:24 am ---1. Abort -> do nothing, no handle exception made, should I? On Windows it is OK, also on Linux it's
--- End quote ---
Abort forces an exception.
--- Quote ---Abort raises an EAbort exception
--- End quote ---
.
So where are you handling the exception?
The exception can be handled differently in beforepost and beforeedit.
It can even be handled differently between OSses.
If you want to abort editing then you could try a Dataset.Cancel.
It'll cancel the edit of the dataset and prevent anything being entered in the TDBEdit.
PS. You could also try to catch the exception at the place where you are calling Dataset.Edit (if you do that manually).
incendio:
--- Quote from: rvk on November 17, 2023, 04:58:09 am ---PS. On the first you do it in beforeEdit.
On the second in beforePost.
If you want to abort editing then you could try a Dataset.Cancel.
It'll cancel the edit of the dataset and prevent anything being entered in the TDBEdit.
--- End quote ---
Tried Dataset.Cancel, only worked once, then didn't work.
When tried to input text 'a' in TDBEdit, it did cancel the input, but input again, will success. BeforeEdit event not triggered again on the second attempt to edit TDBEdit.
Navigation
[0] Message Index
[#] Next page