View Issue Details

IDProjectCategoryView StatusLast Update
0017321LazarusIDEpublic2011-12-01 11:24
ReporterArno Seitzinger Assigned ToJuha Manninen  
Status closedResolutionfixed 
Product Version0.9.29 (SVN) 
Summary0017321: Editor crashes when using two windows
DescriptionEditor crashes under the following circumstances:

open a project or create new project
open a second document in the edit window
right-click and select 'move to new window' (in neues Fenster verschieben)
right-click in the new window

a message box pops up and alerts 'list index (1) out of bounds'

Additional Informationsvn 27242
TagsNo tags attached.
Fixed in Revision27252
Attached Files


related to 0017109 closedMattias Gaertner Regression: MenuIntf causes index out of bounds exception 


Juha Manninen

2010-09-02 10:39

developer   ~0040727

Happens also on Linux.

It happens in unit MenuIntf, TIDEMenuSection.UpdateMenuStructure -> UpdateNeedTopSeparator when
ContainerMenuIndex = 1 and ContainerMenuItem.Count = 0.
Then TIDEMenuSection.Name = 'MoveToOtherWindowList Section' or 'CopyToOtherWindowList Section'

On line 993 there is a test
  if ContainerMenuIndex>ContainerMenuItem.Count then begin

but it only shows some debug info. If I add the following line it starts to work.


I didn't understand why the program ends up in that state, even though the fix works.
A patch comes here. Someone please apply, I don't have write access there.

--- a/ideintf/menuintf.pas
+++ b/ideintf/menuintf.pas
@@ -993,6 +993,7 @@ var
         if ContainerMenuIndex>ContainerMenuItem.Count then begin
           debugln('TIDEMenuSection.UpdateNeedTopSeparator CREATE TopSeparator Name="',Name,'" ContainerMenuIndex=',dbgs(ContainerMenuIndex),' C
           GetRoot.WriteDebugReport(' Top ',true);
+ ContainerMenuIndex:=ContainerMenuItem.Count;

Juha Manninen

2010-09-02 10:41

developer   ~0040728

TIDEMenuSection.UpdateMenuStructure is a recursive method by itself.
In addition, another recursion to UpdateMenuStructure is made through TIDEMenuSection.SetMenuItem.
(You can check it by placing breakpoints on both methods and looking at the call history.)

Is it really correct?

Zeljan Rikalo

2010-09-02 16:03

developer   ~0040741

hm .. this patch maybe hides real bug. Maybe better would be to put an exception here and investigate what causes this.

Juha Manninen

2010-09-02 21:04

developer   ~0040752

Originally the test
  "if ContainerMenuIndex>ContainerMenuItem.Count then begin"
was quite useless. It shows debug info and then always throws the error
  'list index (1) out of bounds'.

The bug is somehow related to the menu item for Moving / Copying to Other Window, which now gets a sub-menu when there are 2 windows. However the main window does not cause the error, only the newly created window does.

Zeljan Rikalo

2010-09-02 21:05

developer   ~0040753

Please test and close if ok.

Issue History

Date Modified Username Field Change
2010-09-01 16:40 Arno Seitzinger New Issue
2010-09-01 16:40 Arno Seitzinger Widgetset => Win32/Win64
2010-09-02 10:36 Juha Manninen Status new => assigned
2010-09-02 10:36 Juha Manninen Assigned To => Juha Manninen
2010-09-02 10:39 Juha Manninen LazTarget => -
2010-09-02 10:39 Juha Manninen Note Added: 0040727
2010-09-02 10:39 Juha Manninen Status assigned => confirmed
2010-09-02 10:41 Juha Manninen Note Added: 0040728
2010-09-02 16:03 Zeljan Rikalo Note Added: 0040741
2010-09-02 21:04 Juha Manninen Note Added: 0040752
2010-09-02 21:05 Zeljan Rikalo Fixed in Revision => 27252
2010-09-02 21:05 Zeljan Rikalo Status confirmed => resolved
2010-09-02 21:05 Zeljan Rikalo Resolution open => fixed
2010-09-02 21:05 Zeljan Rikalo Note Added: 0040753
2010-09-05 00:01 Juha Manninen Relationship added related to 0017109
2011-12-01 11:24 Marc Weustink Status resolved => closed