Project JEDI - Issue Tracker - JEDI VCL
Viewing Issue Advanced Details
5094 00 JVCL Components major always 2010-01-06 15:57 2011-06-10 16:10
migajek  
AHUser  
normal  
resolved Daily / GIT  
fixed  
none    
none 3.40  
0005094: JvDocking - ManualTabDock crashes if application's Main Form is uninitialized yet.
ManualTabDock functions does it:

  if DockClient1.DockState = JvDockState_Docking then
  begin
    ScreenPos := Application.MainForm.ClientRect // Just making it float
    Form1.ManualFloat(ScreenPos);
  end;

which obviously fails in case MainForm is not initialized yet (like in mine case).
Thus it should be replaced with following workaround (I'm not sure if it is correct as I don't get the idea of ManualFloating it, thus I created some random rect)

  if DockClient1.DockState = JvDockState_Docking then
  begin
    if Application.MainForm <> nil then
      ScreenPos := Application.MainForm.ClientRect // Just making it float temporarily.
    else
      ScreenPos := Rect(10, 10, 250, 250);
    Form1.ManualFloat(ScreenPos);
  end;

anyway it doesn't cause Access Violation anymore.

migajek
  if DockClient1.DockState = JvDockState_Docking then
  begin
    if Application.MainForm <> nil then
      ScreenPos := Application.MainForm.ClientRect // Just making it float temporarily.
    else
      ScreenPos := Rect(10, 10, 250, 250); //it doesn't make sense probably
    Form1.ManualFloat(ScreenPos);
  end;
zip file icon jvcl_docking.zip [^] (3,030 bytes) 2010-01-13 20:46
Issue History
2010-01-06 15:57 migajek New Issue
2010-01-13 16:59 obones Note Added: 0017110
2010-01-13 16:59 obones Status new => feedback
2010-01-13 20:46 migajek File Added: jvcl_docking.zip
2010-01-13 20:46 migajek Note Added: 0017117
2010-06-07 13:53 obones Status feedback => acknowledged
2010-06-07 17:53 AHUser Note Added: 0017469
2010-06-07 17:53 AHUser Status acknowledged => resolved
2010-06-07 17:53 AHUser Fixed in Version => Daily / SVN
2010-06-07 17:53 AHUser Resolution open => fixed
2010-06-07 17:53 AHUser Assigned To => AHUser
2011-06-10 16:10 obones Fixed in Version Daily / SVN => 3.40

Notes
(0017110)
obones   
2010-01-13 16:59   
Please provide the zipped sources of a sample application showing this
(0017117)
migajek   
2010-01-13 20:46   
I'm including the source you've asked for, but actually it could be any code that calls ManualTabDock from application's main form OnCreate... It seems that during main form OnCreate execution, Application.MainForm is still nil.

This is true for Delphi 7, I'm not able to test it on any recent version ...
(0017469)
AHUser   
2010-06-07 17:53   
Warren Postma has rewritten the ManualTabDock() method and it doesn't use the Application.MainForm property anymore. With this new code I can't reproduce the bug anymore.