View Issue Details

IDProjectCategoryView StatusLast Update
0026461LazarusLCLpublic2014-11-06 12:31
ReporterPetr-KAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3 (SVN)Product Buildtrunk #45123 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0026461: DBGrid inplace Editor stays locked if error occured in UpdateData
DescriptionIf exception occurs in TCustomDBGrid.UpdateData betwen
StartUpdating and EndUpdating, then DBGrid stays Locked forever.

In my patch I add only

  StartUpdating
  try
    ...
  finally
    EndUpdating
  end

TagsNo tags attached.
Fixed in Revision45816
LazTarget1.4
Widgetset
Attached Files
  • dbgrids.patch (1,795 bytes)
    Index: dbgrids.pas
    ===================================================================
    --- dbgrids.pas	(revision 45123)
    +++ dbgrids.pas	(working copy)
    @@ -1145,27 +1145,30 @@
           {$endif}
     
           StartUpdating;
    -      edField.Text := FTempText;
    -      if edField.Lookup then
    -      begin
    -        LookupKeyValues := Null;
    -        if edField.LookupCache then
    -          LookupKeyValues := edField.LookupList.FirstKeyByValue(FTempText)
    -        else
    +      try
    +        edField.Text := FTempText;
    +        if edField.Lookup then
             begin
    -          LookupGetBookMark(edField);
    -          try
    -            if edField.LookupDataSet.Locate(edField.LookupResultField,
    -              VarArrayOf([FTempText]), []) then
    -                LookupKeyValues :=
    -                  edField.LookupDataSet.FieldValues[edField.LookupKeyFields];
    -          finally
    -            LookupGotoBookMark(edField);
    +          LookupKeyValues := Null;
    +          if edField.LookupCache then
    +            LookupKeyValues := edField.LookupList.FirstKeyByValue(FTempText)
    +          else
    +          begin
    +            LookupGetBookMark(edField);
    +            try
    +              if edField.LookupDataSet.Locate(edField.LookupResultField,
    +                VarArrayOf([FTempText]), []) then
    +                  LookupKeyValues :=
    +                    edField.LookupDataSet.FieldValues[edField.LookupKeyFields];
    +            finally
    +              LookupGotoBookMark(edField);
    +            end;
               end;
    +          edField.DataSet.FieldValues[edField.KeyFields] := LookupKeyValues;
             end;
    -        edField.DataSet.FieldValues[edField.KeyFields] := LookupKeyValues;
    +      finally
    +        EndUpdating;
           end;
    -      EndUpdating;
     
           EditingColumn(FEditingColumn, False);
           {$ifdef dbgDBGrid}
    
    dbgrids.patch (1,795 bytes)

Activities

Petr-K

2014-07-08 17:46

reporter  

dbgrids.patch (1,795 bytes)
Index: dbgrids.pas
===================================================================
--- dbgrids.pas	(revision 45123)
+++ dbgrids.pas	(working copy)
@@ -1145,27 +1145,30 @@
       {$endif}
 
       StartUpdating;
-      edField.Text := FTempText;
-      if edField.Lookup then
-      begin
-        LookupKeyValues := Null;
-        if edField.LookupCache then
-          LookupKeyValues := edField.LookupList.FirstKeyByValue(FTempText)
-        else
+      try
+        edField.Text := FTempText;
+        if edField.Lookup then
         begin
-          LookupGetBookMark(edField);
-          try
-            if edField.LookupDataSet.Locate(edField.LookupResultField,
-              VarArrayOf([FTempText]), []) then
-                LookupKeyValues :=
-                  edField.LookupDataSet.FieldValues[edField.LookupKeyFields];
-          finally
-            LookupGotoBookMark(edField);
+          LookupKeyValues := Null;
+          if edField.LookupCache then
+            LookupKeyValues := edField.LookupList.FirstKeyByValue(FTempText)
+          else
+          begin
+            LookupGetBookMark(edField);
+            try
+              if edField.LookupDataSet.Locate(edField.LookupResultField,
+                VarArrayOf([FTempText]), []) then
+                  LookupKeyValues :=
+                    edField.LookupDataSet.FieldValues[edField.LookupKeyFields];
+            finally
+              LookupGotoBookMark(edField);
+            end;
           end;
+          edField.DataSet.FieldValues[edField.KeyFields] := LookupKeyValues;
         end;
-        edField.DataSet.FieldValues[edField.KeyFields] := LookupKeyValues;
+      finally
+        EndUpdating;
       end;
-      EndUpdating;
 
       EditingColumn(FEditingColumn, False);
       {$ifdef dbgDBGrid}
dbgrids.patch (1,795 bytes)

Petr-K

2014-07-08 17:51

reporter   ~0076142

Sorry not DBGrid stays locked, but inplace Editor stays locked (TCustomGrid.FEditorHidingCount > 0). I cannot correct my bugreport.

Jesus Reyes

2014-07-08 21:13

developer   ~0076144

Applied, thanks.

Issue History

Date Modified Username Field Change
2014-07-08 17:46 Petr-K New Issue
2014-07-08 17:46 Petr-K File Added: dbgrids.patch
2014-07-08 17:51 Petr-K Note Added: 0076142
2014-07-08 21:06 Jesus Reyes Assigned To => Jesus Reyes
2014-07-08 21:06 Jesus Reyes Status new => assigned
2014-07-08 21:07 Jesus Reyes LazTarget => -
2014-07-08 21:07 Jesus Reyes Summary DBGrid stays locked if error occured in UpdateData => DBGrid inplace Editor stays locked if error occured in UpdateData
2014-07-08 21:13 Jesus Reyes Fixed in Revision => 45816
2014-07-08 21:13 Jesus Reyes LazTarget - => 1.4
2014-07-08 21:13 Jesus Reyes Note Added: 0076144
2014-07-08 21:13 Jesus Reyes Status assigned => resolved
2014-07-08 21:13 Jesus Reyes Fixed in Version => 1.3 (SVN)
2014-07-08 21:13 Jesus Reyes Resolution open => fixed
2014-07-08 21:13 Jesus Reyes Target Version => 1.4
2014-11-06 12:31 Petr-K Status resolved => closed