View Issue Details

IDProjectCategoryView StatusLast Update
0034371LazarusPackagespublic2018-10-02 15:01
Reporteraccorp Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
OSXubuntu 16.04 
Product Version1.9 (SVN) 
Summary0034371: AnchorDocking: crash on drag-and-dock tab page
DescriptionRegression of 0032591 caused by r56349.
Steps To ReproduceOpen and run project components/anchordocking/minide/miniide1.lpi
Grab ObjectInpector header and dock it inside SourceEditor.
Grab ObjectInpector tab and dock it inside FPDocEditor => SIGSEGV (Runtime error 210).
TagsNo tags attached.
Fixed in Revisionr59228
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0032591 resolvedJuha Manninen Anchor docking fall with AV and hang IDE after moving Code Explorer to another place 

Activities

accorp

2018-10-02 03:09

reporter  

anchordock2.patch (4,075 bytes)   
Index: components/anchordocking/anchordocking.pas
===================================================================
--- components/anchordocking/anchordocking.pas	(revision 59205)
+++ components/anchordocking/anchordocking.pas	(working copy)
@@ -649,6 +649,7 @@
     // simplification/garbage collection
     procedure BeginUpdate;
     procedure EndUpdate;
+    function IsReleasing(AControl: TControl): Boolean;
     procedure NeedSimplify(AControl: TControl);
     procedure NeedFree(AControl: TControl);
     procedure SimplifyPendingLayouts;
@@ -3439,6 +3440,11 @@
     SimplifyPendingLayouts;
 end;
 
+function TAnchorDockMaster.IsReleasing(AControl: TControl): Boolean;
+begin
+  Result := fNeedFree.IndexOf(AControl) >= 0;
+end;
+
 procedure TAnchorDockMaster.NeedSimplify(AControl: TControl);
 begin
   if Self=nil then exit;
@@ -3460,7 +3466,7 @@
 procedure TAnchorDockMaster.NeedFree(AControl: TControl);
 begin
   //debugln(['TAnchorDockMaster.NeedFree ',DbgSName(AControl),' ',csDestroying in AControl.ComponentState]);
-  if fNeedFree.IndexOf(AControl)>=0 then exit;
+  if IsReleasing(AControl) then exit;
   if csDestroying in AControl.ComponentState then exit;
   fNeedFree.Add(AControl);
   AControl.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}(ADAutoSizingReason){$ENDIF};
@@ -3484,7 +3490,7 @@
       while i>=0 do begin
         AControl:=TControl(fNeedSimplify[i]);
         if (csDestroying in AControl.ComponentState)
-        or (fNeedFree.IndexOf(AControl)>=0) then begin
+        or IsReleasing(AControl) then begin
           fNeedSimplify.Delete(i);
           Changed:=true;
         end else if (AControl is TAnchorDockHostSite) then begin
@@ -3513,7 +3519,7 @@
     // free unneeded controls
     for i := fNeedFree.Count - 1 downto 0 do
       if not (csDestroying in TControl(fNeedFree[i]).ComponentState) then
-        TControl(fNeedFree[i]).Free;
+        Application.ReleaseComponent(TComponent(fNeedFree[i]));
     fNeedFree.Clear;
   finally
     fSimplifying:=false;
@@ -3736,7 +3742,7 @@
   try
     BeginUpdateLayout;
     try
-      DockMaster.QueueSimplify:=True;
+      DockMaster.SimplifyPendingLayouts;
       NewControl.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.ExecuteDock NewControl'){$ENDIF};
 
       if (NewControl.Parent=Self) and (SiteType=adhstLayout) then begin
@@ -4470,6 +4476,7 @@
   Site: TAnchorDockHostSite;
 begin
   if Pages=nil then exit;
+  if DockMaster.IsReleasing(Pages) then exit;
   if Pages.PageCount=1 then begin
     {$IFDEF VerboseAnchorDockPages}
     debugln(['TAnchorDockHostSite.SimplifyPages "',Caption,'" PageCount=1']);
@@ -4486,7 +4493,7 @@
       if SiteType=adhstPages then
         FSiteType:=adhstOneControl;
       // free Pages
-      FreePages;
+      DockMaster.NeedFree(Pages);
       if SiteType=adhstOneControl then
         SimplifyOneControl;
     finally
@@ -4731,7 +4738,7 @@
 begin
   inherited DoDock(NewDockSite, ARect);
   if DockMaster <> nil then
-    DockMaster.QueueSimplify:=True; // Async call to SimplifyPendingLayouts;
+    DockMaster.SimplifyPendingLayouts;
 end;
 
 procedure TAnchorDockHostSite.SetParent(NewParent: TWinControl);
@@ -6706,7 +6713,7 @@
   if Site=nil then exit;
   DockMaster.RestoreLayouts.Add(DockMaster.CreateRestoreLayout(Site),true);
   Site.CloseSite;
-  DockMaster.QueueSimplify:=True;
+  DockMaster.SimplifyPendingLayouts;
 end;
 
 procedure TAnchorDockPageControl.MoveLeftButtonClick(Sender: TObject);
Index: lcl/interfaces/gtk2/gtk2callback.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2callback.inc	(revision 59205)
+++ lcl/interfaces/gtk2/gtk2callback.inc	(working copy)
@@ -2202,7 +2202,10 @@
     MessI.Result := 0;
     NotifyApplicationUserInput(AWinControl, MessI.Msg);
     DeliverMessage(AWinControl, MessI);
-    if MessI.Result <> 0 then
+    if not AWinControl.HandleAllocated then
+      // issue #32591
+      Result := True
+    else if MessI.Result <> 0 then
     begin
       // issue #19914
       if GTK_IS_NOTEBOOK(Widget) then
anchordock2.patch (4,075 bytes)   

accorp

2018-10-02 03:13

reporter   ~0111178

A patch uploaded. It is based on the patch from 0032591 uploaded by Michl with a small change to gtk2callback.inc part, also it reverts r56349, r56156 and r56143.

Juha Manninen

2018-10-02 15:01

developer   ~0111200

Applied, thanks.
The problem happened only with GTK2. Must be caused by different order of GUI events.

Issue History

Date Modified Username Field Change
2018-10-02 00:15 accorp New Issue
2018-10-02 03:09 accorp File Added: anchordock2.patch
2018-10-02 03:13 accorp Note Added: 0111178
2018-10-02 14:06 Juha Manninen Relationship added related to 0032591
2018-10-02 14:46 Juha Manninen Assigned To => Juha Manninen
2018-10-02 14:46 Juha Manninen Status new => assigned
2018-10-02 15:01 Juha Manninen Fixed in Revision => r59228
2018-10-02 15:01 Juha Manninen LazTarget => -
2018-10-02 15:01 Juha Manninen Note Added: 0111200
2018-10-02 15:01 Juha Manninen Status assigned => resolved
2018-10-02 15:01 Juha Manninen Resolution open => fixed