View Issue Details

IDProjectCategoryView StatusLast Update
0006479JEDI VCL00 JVCL Componentspublic2015-12-10 19:34
ReporterAriochAssigned ToAHUser 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformXE2OSOS Version
Product VersionDaily / GIT 
Target VersionDaily / GITFixed in VersionDaily / GIT 
Summary0006479: Crash in TDataSet due to bug in TJvDbGrid
Descriptioni somewhat frozen at 2013 GIT version with few fixes.
But for what i can see there was no change for it.

In some conditions JvDbGrid might cause AV in TDataSet

Bug is attempt to recreate the control when there is none and when the dataset is in process of being closed.

Line 4115 TJvDBGrid.DoAutoSizeColumns
https://github.com/project-jedi/jvcl/blob/master/jvcl/run/JvDBGrid.pas

Proposed fix: insert there: "if WindowHandle = 0 then exit;"
Steps To ReproduceXE2 Win32, UnifiedIB (UIBDataSet) -> DataSource -> TJvDBUltimGrid

TJvDBUltimGrid.OnUserSort:
   UibDataSet.Close;
   UibDataSet.SQL := .... with ORDER BY
   UibDataSet.Open;

TForm.CMVisibleChanged
   read saved sort order
   UibDataSet.Open;
   JvDBUltimGrid.Sort ( saved sorted fields )

    ....from there it goes into OnUserSort and closes the dataset.
    ....from there it goes into TJvDBGrid.DoAutoSizeColumns
    ....the 7th line of the procedure is "AvailableWidth := ClientWidth;"
    ....it calls "VCL.TControl.HandleNeeded" // while WindowHandle=0 !!!
    ....it calls RecreateWnd
    ....it calls re-enter into Auto-Width-Columns sequence when TDataset is half-closed ( Datalink.Active = true but DataSet.Active = false !!! )
    ....it makes fetching fields and their values
    ....it calls TDataSet.ActiveRecord when FBuffers dyn-array is nil -> AV


Additional InformationThe proposed fix avoids fitting columns until the grid is visualized normal way.
And anyway, there is just no point to o on with complex and heavy autofitting when there is no real window created yet!
TagsNo tags attached.

Activities

AHUser

2015-12-10 19:34

developer   ~0021249

Fixed in master branch.

I added that while csLoading is set, the method is also skipped, what reduces the amount of unnecessary work.

Issue History

Date Modified Username Field Change
2015-12-10 15:26 Arioch New Issue
2015-12-10 19:34 AHUser Note Added: 0021249
2015-12-10 19:34 AHUser Status new => resolved
2015-12-10 19:34 AHUser Fixed in Version => Daily / GIT
2015-12-10 19:34 AHUser Resolution open => fixed
2015-12-10 19:34 AHUser Assigned To => AHUser