View Issue Details

IDProjectCategoryView StatusLast Update
0030281LazarusLCLpublic2016-11-07 08:18
ReporterPascal Riekenberg Assigned ToOndrej Pokorny  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionfixed 
Platformi386OSWindows 
Product Version1.7 (SVN) 
Target Version1.6.2 
Summary0030281: Moved is called for already destroyed form an produces AV
DescriptionWith enabled Anchordocking sometimes an AV happens:

#0 MOVED(0xd828600, 0) at ..\..\laz\lcl\include\customform.inc:733
0000001 PROCESSASYNCCALLQUEUE(0x11d750) at ..\..\laz\lcl\include\application.inc:1080
0000002 DESTROY(0x11d750, 0x1) at ..\..\laz\lcl\include\application.inc:145
0000003 SYSTEM$_$TOBJECT_$__$$_FREE at :0
0000004 FREEWIDGETSET at ..\..\laz\lcl\forms.pp:2124
0000005 INTERFACES_$$_finalize at :0
0000006 SYSTEM_$$_FINALIZEUNITS at :0
0000007 SYSTEM_$$_INTERNALEXIT at :0
0000008 $WIN32INT$_Ld13 at :0
0000009 ?? at :0
0000010 SYSTEM_$$_EXE_ENTRY$TENTRYINFORMATION at :0

This is because an async Move is prepared and in Application.Destroy the asyncqueue is handled for the already destroyed form.

To fix this:
TApplication.ControlDestroyed should remove asynccalls for the destroyed object with RemoveAsyncCalls(AControl).

See attached patch.
TagsNo tags attached.
Fixed in Revision
LazTarget1.6.2
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0008576 closedJuha Manninen After Mini/Maximizing window 'RestoredLeft/Top' values changes to "unreal" values 

Activities

Pascal Riekenberg

2016-06-15 13:27

developer  

application.inc.patch (542 bytes)   
Index: lcl/include/application.inc
===================================================================
--- lcl/include/application.inc	(revision 52505)
+++ lcl/include/application.inc	(working copy)
@@ -300,6 +300,7 @@
  ------------------------------------------------------------------------------}
 procedure TApplication.ControlDestroyed(AControl: TControl);
 begin
+  RemoveAsyncCalls(AControl);
   FLastMouseControlValid:=false;
   if AControl=FMouseControl then FMouseControl:=nil;
   if AControl = MainForm then FMainForm:= nil;
application.inc.patch (542 bytes)   

Pascal Riekenberg

2016-06-15 13:30

developer   ~0093216

Forgot to mention that this happens when program is closed

Ondrej Pokorny

2016-06-26 15:44

developer   ~0093374

> This is because an async Move is prepared

Where is this "async Move" prepared/executed?

Btw. it's not a bad idea, to try to handle all such cases systematically. But what about if the same scenario happens for a TObject descendant? :( Therefore IMO the RemoveAsyncCalls should be done at the highest possible level - preferably at least for TComponent.

Pascal Riekenberg

2016-07-29 09:52

developer   ~0093880

It seems that it is somewhere in the anchordocking package.
I didn't manage to locate it and as RemoveAsyncCalls solved it for me i didn't spent more time investigating this.

Ondrej Pokorny

2016-08-01 18:44

developer   ~0093945

The patch won't be committed. When QueueAsyncCall is called it is the programmer's responsibility to RemoveAsyncCalls in the destructor.

> I didn't manage to locate it and as RemoveAsyncCalls solved it for me i didn't spent more time investigating this.

Well, you should have :)

The Moved() function is queued in TCustomForm.WMMove.

Please test. If OK, it will be added to 1.6.2

Pascal Riekenberg

2016-08-08 15:15

developer   ~0094057

It seems to be fixed. It didn't appear again until now.

Issue History

Date Modified Username Field Change
2016-06-15 13:27 Pascal Riekenberg New Issue
2016-06-15 13:27 Pascal Riekenberg File Added: application.inc.patch
2016-06-15 13:30 Pascal Riekenberg Note Added: 0093216
2016-06-15 19:56 Ondrej Pokorny Assigned To => Ondrej Pokorny
2016-06-15 19:56 Ondrej Pokorny Status new => assigned
2016-06-26 15:44 Ondrej Pokorny Note Added: 0093374
2016-06-28 17:39 Ondrej Pokorny LazTarget => -
2016-06-28 17:39 Ondrej Pokorny Status assigned => feedback
2016-07-29 09:52 Pascal Riekenberg Note Added: 0093880
2016-07-29 09:52 Pascal Riekenberg Status feedback => assigned
2016-08-01 18:37 Ondrej Pokorny Relationship added related to 0008576
2016-08-01 18:44 Ondrej Pokorny LazTarget - => 1.6.2
2016-08-01 18:44 Ondrej Pokorny Note Added: 0093945
2016-08-01 18:44 Ondrej Pokorny Status assigned => resolved
2016-08-01 18:44 Ondrej Pokorny Resolution open => fixed
2016-08-01 18:44 Ondrej Pokorny Target Version => 1.6.2
2016-08-08 15:15 Pascal Riekenberg Note Added: 0094057
2016-11-07 08:18 Pascal Riekenberg Status resolved => closed