View Issue Details

IDProjectCategoryView StatusLast Update
0004020JEDI VCL00 JVCL Componentspublic2007-03-20 14:37
ReporterKiriakosAssigned Toremkobonte 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.34 
Summary0004020: JvDocking error when reading layout
DescriptionTo replicate

a) In one of the Dock Forms add an OnFormActivate event with the following code:
  Application.ProcessMessages
b) Save a layout with that form visible but not docked
c) Load the saved layout -> List index out of bounds error

Analysis:
The LoadDockTreeFrom* methods create a fantom form the purpose of which escapes me. At the end of these methods you have the following code:

 1405 Form.Release;
 1406 JvDockUnLockWindow;
 1407 JvDockInfoTree.Free;
 1408 end;
 1409 ReshowAllVisibleWindow;

Here is ReshowAllVisibleWindow:


 1652 procedure ReshowAllVisibleWindow;
 1653 var
 1654 I: Integer;
 1655 begin
 1656 if IsWinXP then
 1657 for I := 0 to Screen.FormCount - 1 do
 1658 if Screen.Forms[I].Visible then
 1659 Windows.ShowWindow(Screen.Forms[I].Handle, SW_SHOW)
 1660 else
 1661 Windows.ShowWindow(Screen.Forms[I].Handle, SW_HIDE);
 1662 end;

This methods iterates through all forms from the Screen.Form list and shows/hides them. In doing so it modifies the Z-order of the forms and is not actully recommended to do that but this actually works and is not the problem. The problem lies in that we have called Form.Release on the fantom form, so it has not been freed yet and is included in Screen.Forms. While in the loop, if the OnFormActivate event handler of one of the forms calls Application.ProcessMessages that form gets destroyed halfway through the loop causing a List index error on the last iteration.

Solution:
In the three LoadDockTreeFrom* methods replace
  Form.Release
with
  Form.Free

This should not have any side effects since the fantom form does not have any pending events. In fact you may want to consider removing all the code related to the fantom form. Doing so does not affect my application in any way and as I said I cannot the purpose of this code.
TagsNo tags attached.

Activities

remkobonte

2007-03-08 17:24

developer   ~0011300

Last edited: 2007-03-08 17:25

The original code has a Chinese comment that translates to something like:

Create a form with window size of 0, the effect was to prevent the Windows Screen Flicker.

Kiriakos

2007-03-10 15:40

reporter   ~0011302

I cannot see how this affects flicker, but to be in the safe side you may keep that code in and just change Release to Free in all three methods. This should have no side effects.

remkobonte

2007-03-20 14:37

developer   ~0011523

I've removed the code that creates a temporary window.

But when I create a temporary window in the TMainForm.LoadFromAppStorage procedure of the AdvanceDemo - before the LoadFormsFromAppStorage call - I actually see some visual difference, ie less flicker. This is on a slow computer.

I still removed the code because IMO it is up to the component user to use such tricks.

This is in Rev 11224.

Issue History

Date Modified Username Field Change
2006-12-13 19:40 Kiriakos New Issue
2007-03-08 17:24 remkobonte Note Added: 0011300
2007-03-08 17:25 remkobonte Note Edited: 0011300
2007-03-10 15:40 Kiriakos Note Added: 0011302
2007-03-20 14:37 remkobonte Status new => resolved
2007-03-20 14:37 remkobonte Fixed in Version => Daily / SVN
2007-03-20 14:37 remkobonte Resolution open => fixed
2007-03-20 14:37 remkobonte Assigned To => remkobonte
2007-03-20 14:37 remkobonte Note Added: 0011523