View Issue Details

IDProjectCategoryView StatusLast Update
0003879JEDI VCL00 JVCL Componentspublic2006-08-30 07:23
ReporterivobauerAssigned Toobones 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.30 
Summary0003879: TJvTabBar is broken in the latest SVN snapshot
DescriptionIf you have a TJvTabBar on the form and it contains at least one tab, you will experience a crash (access violation) as soon as you try to close/destroy the form. I've tested this with daily SVN JCL/JVCL build (both are dated 2006-08-29).
Steps To Reproduce1. Create a new Delphi for Win32 project
2. Drop TJvTabBar on the form
3. Add at least one tab item
4. Compile and run the project
5. Try to close the main form and crash follows.
Additional InformationI have debugged this problem and came to the following conclusion:

1. When TJvTabBar is being destroyed, it tries to free the internal tab item collection it holds by calling "FreeAndNil(FTabs);" in the TJvTabBar.Destroy method.

2. This in turn causes a series of method calls to occur, namely invoking the destructor of FTabs collection which in turn tries to remove the items one by one.

3. The next method called in this chain is TJvTabBarItems.Notification which contains the following code snippet:

    if TabBar.LeftTab = Item then
      TabBar.LeftTab := TabBar.LeftTab.GetPreviousVisible;

The problem occurs while accessing the LeftTab property of TabBar because the getter method GetLeftTab tries to access the FTabs.Count property but since the TJvTabBar destructor uses FreeAndNil to free the tabs collection, the private field FTabs is already NILLED at this time, this is why the AV occurs.

Proposed fix: Replace this line in TJvTabBar.Destroy method:

  FreeAndNil(FTabs);

by this one:

  FTabs.Free; //FreeAndNil(FTabs);

I've recompiled the JVCL installation on my machine and the problem no longer occurs. So I'd say this fix works just fine for me.
TagsNo tags attached.

Activities

obones

2006-08-30 07:23

administrator   ~0010035

This is now fixed in SVN

Issue History

Date Modified Username Field Change
2006-08-30 05:00 ivobauer New Issue
2006-08-30 07:23 obones Status new => resolved
2006-08-30 07:23 obones Fixed in Version => Daily / SVN
2006-08-30 07:23 obones Resolution open => fixed
2006-08-30 07:23 obones Assigned To => obones
2006-08-30 07:23 obones Note Added: 0010035