View Issue Details

IDProjectCategoryView StatusLast Update
0006158JEDI VCL00 JVCL Componentspublic2014-12-04 16:31
Reportersurfer007Assigned Toobones 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionsuspended 
Product VersionDaily / GIT 
Target VersionFixed in Version 
Summary0006158: JvDriveCtrls
DescriptionTJvFileListBox.DrawItem fires exception when directory is empty.
List index out of bounds (0)
TagsNo tags attached.

Activities

2013-07-02 15:18

 

bug_filelistbox.bmp (2,896,794 bytes)

AHUser

2013-07-04 17:25

developer   ~0020553

What Delphi version do you use?

I can't reproduce this with XE4 and the JVCL's master branch.

surfer007

2013-07-05 00:36

reporter   ~0020556

It is D7. The bug happens only when i run the application and the folder is empty.

Arioch

2013-07-08 11:40

developer   ~0020562

which JVCL version u use ? is it really last git/daily?

surfer007

2013-07-08 13:17

reporter   ~0020563

i just installed files from today, jcl-2.5.0.4877.7z and JVCL3-2013-07-08.zip
and have still the error.

By the way, the drive is mapped from a usb stick on the Fritz!Box to z:
On Form.Create i set the directory:

JvFileListBox.Directory := 'z:\images\new';

As talked, if the directory is empty the AV happens.
Index is 0 and does not exists!

Here is my workaround:

procedure TJvFileListBox.DrawItem(Index: Integer; Rect: TRect;
  State: TOwnerDrawState);
var
  Offset: Integer;
  tmpR: TRect;
  ImageIndex: Integer;
  OverlayIndex: Integer;
begin
  with Canvas do
  begin
    // FillRect(Rect);
    Offset := 2;
    tmpR := Rect;
    if ShowGlyphs then
    begin
      ImageIndex := Integer(Items.Objects[Index]);
      OverlayIndex := (ImageIndex shr 24) - 1;
      if OverlayIndex >= 0 then
        FImages.DrawOverlay(Canvas, Rect.Left + 2, (Rect.Top + Rect.Bottom - FImages.Height) div 2,
          ImageIndex and $00FFFFFF, OverlayIndex)
      else
        FImages.Draw(Canvas, Rect.Left + 2, (Rect.Top + Rect.Bottom - FImages.Height) div 2,
          ImageIndex);
      Offset := FImages.Width + 6;
    end;

    tmpR.Left := tmpR.Left + Offset - 2;

    //tmpR.Right := tmpR.Left + TextWidth(Items[Index]) + 4;
    if Items.Count > 0 then begin
      tmpR.Right := tmpR.Left + TextWidth(Items[Index]) + 4;
    end else begin
      tmpR.Right := tmpR.Left + 62;
    end;

    FillRect(tmpR);

    //TextOut(Rect.Left + Offset, Rect.Top, Items[Index]);
    if Items.Count > 0 then TextOut(Rect.Left + Offset, Rect.Top, Items[Index]);

    if odFocused in State then
      DrawFocusRect(tmpR);
  end;
end;

Arioch

2013-08-31 04:00

developer   ~0020611

What si a callstack ? who does call TJvFileListBox.DrawItem(0,... on empty folders ? it just should not happen...

obones

2013-12-13 11:44

administrator   ~0020798

We really need a sample application showing this

obones

2014-12-04 16:31

administrator   ~0021115

No news, suspending the issue

Issue History

Date Modified Username Field Change
2013-07-02 15:18 surfer007 New Issue
2013-07-02 15:18 surfer007 File Added: bug_filelistbox.bmp
2013-07-04 17:25 AHUser Note Added: 0020553
2013-07-04 17:25 AHUser Status new => feedback
2013-07-05 00:36 surfer007 Note Added: 0020556
2013-07-08 11:40 Arioch Note Added: 0020562
2013-07-08 13:17 surfer007 Note Added: 0020563
2013-08-31 04:00 Arioch Note Added: 0020611
2013-12-13 11:44 obones Note Added: 0020798
2014-12-04 16:31 obones Note Added: 0021115
2014-12-04 16:31 obones Status feedback => resolved
2014-12-04 16:31 obones Resolution open => suspended
2014-12-04 16:31 obones Assigned To => obones