View Issue Details

IDProjectCategoryView StatusLast Update
0025811LazarusIDEpublic2014-03-04 20:30
ReporterStéphane WierzbickiAssigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWin32OSWindows OS VersionAny
Product Version1.2.0RC2Product Build 
Target Version1.2.2Fixed in Version1.2.1 (SVN) 
Summary0025811: IDE Crash when opening the project source
DescriptionIDE Crash when opening the project source

multi-line (opening) peer valid (syneditmarkupifdef.pp, line 1961).

Press Ok to ignore...
Press Cancel to close...
Steps To ReproduceOpen attached project.
TagsNo tags attached.
Fixed in Revision44345
LazTarget1.2.2
WidgetsetWin32/Win64
Attached Files
  • Laz 1.2 RC2 - SynEdit crash.rar (126,247 bytes)
  • synfix.diff (1,698 bytes)
    Index: syneditmarkupifdef.pp
    ===================================================================
    --- syneditmarkupifdef.pp	(revision 44344)
    +++ syneditmarkupifdef.pp	(revision 44345)
    @@ -1957,18 +1959,22 @@
         //end;
     
         assert(not (PeerList[i].NodeType in [idnIfdef, idnCommentedNode]), 'multi-line peer valid');
    -    //if (PeerList[i].NodeType = idnElse) and (AOuterLines <> nil) then begin
    +
    +    // AOuterLines is only set while scanning opening lines in front of the 1st visible screenline
    +    //   (at the start of ValidateRange)
         if (AOuterLines <> nil) then begin
    -    // todo: find multiply elseif
    -      assert((PeerList[i].NodeType in [idnElse, idnElseIf]), 'multi-line (opening) peer valid');
    -      // scanning outer lines
    -      j := ToPos(AOuterLines.NodeLineEx[i-1, 1]);
    -      if j < 0 then begin
    -        //debugln(['Skipping peer for ELSE with NO IFDEF at depth ', i-1, ' before line ', ANode.StartLine]);
    -        continue;
    -      end;
    -      OtherLine := GetOrInsertNodeAtLine(j);
    -      MaybeValidateNode(OtherLine);
    +      if PeerList[i].NodeType in [idnElse, idnElseIf] then begin
    +        // todo: find multiply elseif
    +        j := ToPos(AOuterLines.NodeLineEx[i-1, 1]);
    +        if j < 0 then begin
    +          //debugln(['Skipping peer for ELSE with NO IFDEF at depth ', i-1, ' before line ', ANode.StartLine]);
    +          continue;
    +        end;
    +        OtherLine := GetOrInsertNodeAtLine(j);
    +        MaybeValidateNode(OtherLine);
    +      end
    +      else
    +        continue; // while scanning outerlines, any EndIf can be ignored
         end
         else
           OtherLine := ANestList.Node[i]; // Todo: keep if same al last loop, and continue at OtherDepth / j
    
    synfix.diff (1,698 bytes)

Activities

Stéphane Wierzbicki

2014-03-03 09:14

reporter  

Laz 1.2 RC2 - SynEdit crash.rar (126,247 bytes)

Martin Friebe

2014-03-04 16:54

manager   ~0073431

As a workaround until fixed, you can disable all colors and highlight for any IFDEF. This will deactivate the module, and should prevent the crash.

Martin Friebe

2014-03-04 20:28

manager  

synfix.diff (1,698 bytes)
Index: syneditmarkupifdef.pp
===================================================================
--- syneditmarkupifdef.pp	(revision 44344)
+++ syneditmarkupifdef.pp	(revision 44345)
@@ -1957,18 +1959,22 @@
     //end;
 
     assert(not (PeerList[i].NodeType in [idnIfdef, idnCommentedNode]), 'multi-line peer valid');
-    //if (PeerList[i].NodeType = idnElse) and (AOuterLines <> nil) then begin
+
+    // AOuterLines is only set while scanning opening lines in front of the 1st visible screenline
+    //   (at the start of ValidateRange)
     if (AOuterLines <> nil) then begin
-    // todo: find multiply elseif
-      assert((PeerList[i].NodeType in [idnElse, idnElseIf]), 'multi-line (opening) peer valid');
-      // scanning outer lines
-      j := ToPos(AOuterLines.NodeLineEx[i-1, 1]);
-      if j < 0 then begin
-        //debugln(['Skipping peer for ELSE with NO IFDEF at depth ', i-1, ' before line ', ANode.StartLine]);
-        continue;
-      end;
-      OtherLine := GetOrInsertNodeAtLine(j);
-      MaybeValidateNode(OtherLine);
+      if PeerList[i].NodeType in [idnElse, idnElseIf] then begin
+        // todo: find multiply elseif
+        j := ToPos(AOuterLines.NodeLineEx[i-1, 1]);
+        if j < 0 then begin
+          //debugln(['Skipping peer for ELSE with NO IFDEF at depth ', i-1, ' before line ', ANode.StartLine]);
+          continue;
+        end;
+        OtherLine := GetOrInsertNodeAtLine(j);
+        MaybeValidateNode(OtherLine);
+      end
+      else
+        continue; // while scanning outerlines, any EndIf can be ignored
     end
     else
       OtherLine := ANestList.Node[i]; // Todo: keep if same al last loop, and continue at OtherDepth / j
synfix.diff (1,698 bytes)

Martin Friebe

2014-03-04 20:30

manager   ~0073464

Fix will be in 1.2.2. Unfortunately the release build was already done, at the time of this report.
Attached patch can be applied to 1.2.0

Please test (either now, or when 1.2.2 is out) and close if ok.

Issue History

Date Modified Username Field Change
2014-03-03 09:14 Stéphane Wierzbicki New Issue
2014-03-03 09:14 Stéphane Wierzbicki File Added: Laz 1.2 RC2 - SynEdit crash.rar
2014-03-03 13:21 Zeljan Rikalo Assigned To => Martin Friebe
2014-03-03 13:21 Zeljan Rikalo Status new => assigned
2014-03-04 16:54 Martin Friebe LazTarget => 1.2.2
2014-03-04 16:54 Martin Friebe Note Added: 0073431
2014-03-04 16:54 Martin Friebe Target Version => 1.2.2
2014-03-04 20:28 Martin Friebe File Added: synfix.diff
2014-03-04 20:30 Martin Friebe Fixed in Revision => 44345
2014-03-04 20:30 Martin Friebe Note Added: 0073464
2014-03-04 20:30 Martin Friebe Status assigned => resolved
2014-03-04 20:30 Martin Friebe Fixed in Version => 1.2.1 (SVN)
2014-03-04 20:30 Martin Friebe Resolution open => fixed