View Issue Details

IDProjectCategoryView StatusLast Update
0019331LazarusIDEpublic2011-10-21 17:50
ReporterGary Allen Wiltshire Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformToshiba NB505 MicronOSWindows 7 
Summary0019331: Failure to save Lazarus Desktop Settings - FP 2.4.3 win32 - Lazarus 0.9.31 - 30650
DescriptionNo file is saved when the dialog is accessed to save the desktop settings either to an .LDS or and .XML file, whether or not the extension is specified, likewise supplied paths make no difference. A search of entire hard drive shows no misplaced .LDS files. This feature would be useful as I use two machines with radically different screen resolutions.
Steps To ReproduceSelect Environment > Options > Desktop >Save desktop settings to file.

Choose path above and entire file name below, with or without extension.

Press [Enter] or click <Save>. No joy.
Additional InformationThe action is properly recorder in the MRU and is visible in the registry.
TagsNo tags attached.
Fixed in Revisionr32990, r33007
LazTarget0.99.0
Widgetset
Attached Files

Relationships

duplicate of 0018504 resolvedVincent Snijders Button: Save desktop settings to file (not saved) 

Activities

Gary Allen Wiltshire

2011-05-11 00:20

reporter   ~0048204

Mispoke on "registry." It is recorded in Lazarus's MRU.

Vincent Snijders

2011-10-05 15:58

manager   ~0052571

Error on console:
ERROR: [TEnvironmentOptionsDialog.SaveDesktopSettingsToFileButtonClick] Unknown Run-Time error : 210

Vincent Snijders

2011-10-05 16:22

manager   ~0052574

Stack Trace:
#0 fpc_raiseexception(0xf9c8f4, 0x7e680, 0x76171f) at except.inc:191
0000001 TSIMPLEWINDOWLAYOUTLIST__CREATEWINDOWLAYOUT((ANSISTRING) 0xf9c8f4, (TSIMPLEWINDOWLAYOUTLIST) 0x7e680) at idewindowintf.pas:1201
0000002 TENVIRONMENTOPTIONS__INITLAYOUTLIST((TENVIRONMENTOPTIONS) 0xf9e6b58) at environmentopts.pp:1620
0000003 TENVIRONMENTOPTIONS__CREATE((POINTER) 0xfd2140, (TENVIRONMENTOPTIONS) 0xf9e6b58) at environmentopts.pp:718
0000004 TDESKTOPOPTIONSFRAME__SAVEDESKTOPSETTINGSTOFILEBUTTONCLICK((^TOBJECT) 0xd26e890, (TDESKTOPOPTIONSFRAME) 0x1065b5e0) at .\frames\desktop_options.pas:260

Bart Broersma

2011-10-05 17:33

developer   ~0052586

I get an
"ERROR: [TEnvironmentOptionsDialog.SaveDesktopSettingsToFileButtonClick] Access violation"
And the filename never makes it into the MRU list.

This occurs on line 260 of ide/desktop_options.pas in procedure TDesktopOptionsFrame.SaveDesktopSettingsToFileButtonClick()

  AnEnvironmentOptions := TEnvironmentOptions.Create;
  
The AV is triggered on this line.

Vincent Snijders

2011-10-05 18:33

manager   ~0052589

Bart, that is the same.

Bart Broersma

2011-10-05 18:55

developer   ~0052590

Last edited: 2011-10-05 18:58

TEnvironmentOptions.Create calls
TEnvironmentOptions.InitLayoutList which calls
IDEWindowcreators.SimpleLayoutStorage.CreateWindowLayout
this method raises an exception if ItemByFormID(TheFormID) is not nil
which in our scenario is the case:
- ItemByFormID('MainIDE') is not nil

So an exception is raised in the constructor when calling
  AnEnvironmentOptions := TEnvironmentOptions.Create;

The IDEWindowsCreators seems to be designed to act as if there can only ever be one instance of it. And one is indeed created when Lazarus starts.
So before calling IDEWindowcreators.SimpleLayoutStorage.CreateWindowLayout we should first check if IDEWindowcreators.SimpleLayoutStorage.ItemByFormID() reurns nil.

I'll attach a patch based upon the above.

2011-10-05 18:56

 

environmentopts.pp.diff (861 bytes)   
Index: ide/environmentopts.pp
===================================================================
--- ide/environmentopts.pp	(revision 32705)
+++ ide/environmentopts.pp	(working copy)
@@ -1617,8 +1617,10 @@
 begin
   for l:=Low(TNonModalIDEWindow) to High(TNonModalIDEWindow) do
     if l<>nmiwNone then
+      if not Assigned(IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(NonModalIDEWindowNames[l])) then
       IDEWindowCreators.SimpleLayoutStorage.CreateWindowLayout(NonModalIDEWindowNames[l]);
-  IDEWindowCreators.SimpleLayoutStorage.CreateWindowLayout(DefaultObjectInspectorName);
+  if not Assigned(IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(DefaultObjectInspectorName)) then
+    IDEWindowCreators.SimpleLayoutStorage.CreateWindowLayout(DefaultObjectInspectorName);
 end;
 
 function TEnvironmentOptions.GetTestBuildDirectory: string;
environmentopts.pp.diff (861 bytes)   

Bart Broersma

2011-10-05 18:57

developer   ~0052591

Last edited: 2011-10-05 19:01

@Vincent: I wrote my note at the same time you were writing yours (it took me several rebuilds to get to that point, so it took me quit some time indeed), so I did not see it before I posted it ;-)

Vincent Snijders

2011-10-05 22:04

manager   ~0052600

@Bart, I did not expect that because of the more than an hour time difference. :-)

Juha Manninen

2011-10-19 23:23

developer   ~0053178

I applied a modified version of the patch in r32990. Thanks.
I also added MessageBoxes to indicate the settings really were saved/loaded.

When loading the settings, this method:
  TSimpleWindowLayoutList.LoadFromConfig
is called for window layout.
However it sets only windows that are not yet in SimpleLayoutStorage.
I think we should add a "Force" parameter or similar to read the settings in any case, the same way as other settings are read.

Juha Manninen

2011-10-21 17:50

developer   ~0053245

TSimpleWindowLayoutList.LoadFromConfig works correctly.
I added code to update windows layout after loading the settings in r33007.
Please test.

Issue History

Date Modified Username Field Change
2011-05-11 00:05 Gary Allen Wiltshire New Issue
2011-05-11 00:20 Gary Allen Wiltshire Note Added: 0048204
2011-05-11 10:02 Jonas Maebe Project FPC => Lazarus
2011-10-05 15:58 Vincent Snijders LazTarget => -
2011-10-05 15:58 Vincent Snijders Note Added: 0052571
2011-10-05 15:58 Vincent Snijders Status new => confirmed
2011-10-05 16:22 Vincent Snijders Note Added: 0052574
2011-10-05 17:33 Bart Broersma Note Added: 0052586
2011-10-05 18:33 Vincent Snijders Note Added: 0052589
2011-10-05 18:55 Bart Broersma Note Added: 0052590
2011-10-05 18:56 Bart Broersma File Added: environmentopts.pp.diff
2011-10-05 18:57 Bart Broersma Note Added: 0052591
2011-10-05 18:58 Bart Broersma Note Edited: 0052590
2011-10-05 18:58 Bart Broersma Note Edited: 0052590
2011-10-05 19:01 Bart Broersma Note Edited: 0052591
2011-10-05 22:04 Vincent Snijders Note Added: 0052600
2011-10-08 21:04 Vincent Snijders Relationship added duplicate of 0018504
2011-10-11 00:51 Maxim Ganetsky LazTarget - => 0.99.0
2011-10-11 00:51 Maxim Ganetsky Product Version 2.4.3 =>
2011-10-11 00:51 Maxim Ganetsky Target Version => 0.99.0
2011-10-19 23:04 Juha Manninen Status confirmed => assigned
2011-10-19 23:04 Juha Manninen Assigned To => Juha Manninen
2011-10-19 23:23 Juha Manninen Note Added: 0053178
2011-10-19 23:23 Juha Manninen Status assigned => feedback
2011-10-21 17:50 Juha Manninen Fixed in Revision => r32990, r33007
2011-10-21 17:50 Juha Manninen Status feedback => resolved
2011-10-21 17:50 Juha Manninen Resolution open => fixed
2011-10-21 17:50 Juha Manninen Note Added: 0053245