View Issue Details

IDProjectCategoryView StatusLast Update
0032820LazarusIDEpublic2018-01-01 23:02
ReporterVojtech Cihak Assigned ToJuha Manninen  
Status closedResolutionfixed 
Product Version1.9 (SVN) 
Summary0032820: Designer events (SVN and 1.8)
DescriptionThere are eight items in popup menu (see demooidesig.pas):

0: 'Add + Modified'
 doesn't select added item even if parameter Select of PersistentAdded() is True

1: 'Add + SelectOnlyThis(Item)'
 SelectOnlyThis works here, added item is selected

2: 'Add + SelectOnlyThis(Control)'
 SelectOnlyThis works here, owner control is selected in OI and focused

3: 'Delete'
 item deleted from components but node is not deleted from component tree of OI

4: 'Delete + Modified'
 item deleted from components but node is not deleted from component tree of OI

5: 'Delete + aHook.RefreshPropertyValues'
 item deleted from components but node is not deleted from component tree of OI

6: 'Delete + SelectOnlyThis'
 item deleted from components but node is not deleted from component tree of OI

7: 'Delete + PersistentAdded'
 this hack works, PersistentAdded is called even if nothing was added. Node in component tree is deleted.
Steps To ReproduceInstall attached packege. It will add the TDemoControl to the Misc palette.

Put that control on the form and use its popup menu items and observe component tree in OI.

Warning: when you click component tree of OI when its nodes does not correspond with items of TDemoControl, it will cause AV and you will have to restart Lazarus.
Additional InformationLazarus 1.9.0 r56652:56710M FPC 3.0.4 x86_64-linux-qt

Lazarus 1.8.0 r56594 FPC 3.0.4 i386-win32-win32/win64

Some more info (from e-mail which I sent 26.11. to ML):
Everything was OK to revision 52209. OI was completly broken between 52210 and 52229 (components didn't appear at all). Revision 52230 improved OI but deleting didn't work as described in previous mails, it's up to now.

PS: My most comprehensive bugreport :)
TagsNo tags attached.
Fixed in Revisionr56880, r56904
Attached Files


Vojtech Cihak

2017-12-14 16:16

reporter (2,659 bytes)

Juha Manninen

2017-12-30 19:30

developer   ~0105160

Last edited: 2017-12-30 19:31

View 3 revisions

Please test with r56880. The deletion should be fixed now.
I think keeping the selection in the component (DemoControl) is intentional. Otherwise selection changes also in Designer. You can always call SelectOnlyThis() when you need to.

Vojtech Cihak

2017-12-31 12:45

reporter   ~0105186

Now it works, except cases where Modified; is called after deleting (Delete + Modified in demo). But in fact, calling Modified is not needed, it all works without it now.

When I click "Delete + Modified":

Lazarus + Qt, 56880:
TDesigner.OnComponentEditorVerbMenuItemClick ERROR: Access violation
lazarus.pp - unhandled exception
[FORMS.PP] ExceptionOccurred
  Exception=Access violation
  Stack trace:
  $0000000000E62507 line 833 of mainbar.pas
  $00000000004C41CA line 3549 of main.pp
  $00000000004B74D6 line 1621 of main.pp
  $000000000047BCC5 line 1921 of forms.pp
TApplication.HandleException Access violation
  Stack trace:
  $0000000000E62507 line 833 of mainbar.pas
  $00000000004C41CA line 3549 of main.pp
  $00000000004B74D6 line 1621 of main.pp
  $000000000047BCC5 line 1921 of forms.pp
TApplication.HandleException: there was another exception during showing the first exception
  Stack trace:
  $000000000047C311 line 2044 of forms.pp
  $00000000006D9560 line 787 of include/
  $0000000000B34E3C line 340 of componentpalette.pas
  $0000000000B3828C line 997 of componentpalette.pas
  $0000000000B3770D line 825 of componentpalette.pas
  $0000000000E618F6 line 675 of mainbar.pas
  $00000000004EC444 line 11249 of main.pp
  $0000000000B568C6 line 4293 of ../designer/designer.pp
  $0000000000B4FE73 line 3058 of ../designer/designer.pp
  $00000000006DE6FF line 2200 of include/
  $00000000006CA846 line 5405 of include/
  $000000000048724B line 1467 of include/
  $0000000000778598 line 5735 of qt/qtwidgets.pas
  $000000000077F9E7 line 8044 of qt/qtwidgets.pas
  $000000000077EE8E line 7721 of qt/qtwidgets.pas
  $00000000007A6662 line 19688 of qt/qtwidgets.pas
[FORMS.PP] ExceptionOccurred
Heap dump by heaptrc unit
2952205 memory blocks allocated : 285050298/291180288
2878855 memory blocks freed : 275458729/281500840
73350 unfreed memory blocks : 9591569
True heap size : 39452672
True free heap : 18446944
Should be : 20384424

Lazarus + GTk2, 56880:
TApplication.HandleException Object reference is Nil
  Stack trace:
  $0000000000B60F13 line 3287 of ../designer/designer.pp
  $0000000000A8FB7E line 544 of menuintf.pas
  $0000000000A95430 line 1705 of menuintf.pas
  $000000000064C035 line 83 of include/
  $000000000064CBE9 line 280 of include/
  $00000000007080EE line 3706 of gtk2/
  $00000000008DCD92 line 139 of gtk2/gtk2wsmenus.pp

Juha Manninen

2017-12-31 16:48

developer   ~0105203

Yes, I also got access violation from Modified call. I am puzzled because debugger didn't give any useful info. Pressing F7 didn't go inside the method but gave an access violation immediately.
Do you understand why it happens?

Vojtech Cihak

2017-12-31 17:22

reporter   ~0105205

I put this line in front of Modified:

writeln('ass(getdesigner) ', boolToStr(assigned(GetDesigner), 'T', 'F'));

Lazarus crashes with AV and this output:
ass(getdesigner) TDesigner.OnComponentEditorVerbMenuItemClick ERROR: Access violation

Which means that ComponentEditor does not exist at that moment. Maybe calling Modified after deleting is not a bug but simply a bad practice and no change is needed.

Juha Manninen

2018-01-01 19:38

developer   ~0105235

Right, the component editor (DemoOIEditor) was freed when CollectionItem was deleted. I fixed it in r56904. Please test.

Does this solve the problems also in your EC-Controls?

Vojtech Cihak

2018-01-01 21:58

reporter   ~0105244

Tested with Lazarus 1.9.0 r56910M FPC 3.0.4 x86_64-linux-qt.
Demo works well. EC-Controls (TECTabCtrl and TECGrid) too. In meanwhile I removed all "Modified" calls since they seem to be not needed anymore.
Can be resolved. Thanks.

Juha Manninen

2018-01-01 22:34

developer   ~0105248

Ok, resolving. The 2 commits will be merged to Lazarus 1.8.2.

Vojtech Cihak

2018-01-01 23:02

reporter   ~0105250


Issue History

Date Modified Username Field Change
2017-12-14 16:16 Vojtech Cihak New Issue
2017-12-14 16:16 Vojtech Cihak File Added:
2017-12-27 21:30 Juha Manninen Assigned To => Juha Manninen
2017-12-27 21:30 Juha Manninen Status new => assigned
2017-12-30 19:30 Juha Manninen LazTarget => -
2017-12-30 19:30 Juha Manninen Note Added: 0105160
2017-12-30 19:30 Juha Manninen Status assigned => feedback
2017-12-30 19:30 Juha Manninen Note Edited: 0105160 View Revisions
2017-12-30 19:31 Juha Manninen Note Edited: 0105160 View Revisions
2017-12-31 12:45 Vojtech Cihak Note Added: 0105186
2017-12-31 12:45 Vojtech Cihak Status feedback => assigned
2017-12-31 16:48 Juha Manninen Note Added: 0105203
2017-12-31 17:22 Vojtech Cihak Note Added: 0105205
2018-01-01 19:38 Juha Manninen Note Added: 0105235
2018-01-01 19:38 Juha Manninen Status assigned => feedback
2018-01-01 21:58 Vojtech Cihak Note Added: 0105244
2018-01-01 21:58 Vojtech Cihak Status feedback => assigned
2018-01-01 22:34 Juha Manninen Fixed in Revision => r56880, r56904
2018-01-01 22:34 Juha Manninen Note Added: 0105248
2018-01-01 22:34 Juha Manninen Status assigned => resolved
2018-01-01 22:34 Juha Manninen Resolution open => fixed
2018-01-01 23:02 Vojtech Cihak Note Added: 0105250
2018-01-01 23:02 Vojtech Cihak Status resolved => closed