View Issue Details

IDProjectCategoryView StatusLast Update
0014144LazarusLCLpublic2010-03-23 13:53
ReporterAnton Kavalenka Assigned ToPaul Ishenin  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Platformx86_64OSDebian GNU/Linux 
Product Version0.9.27 (SVN) 
Target Version1.0.0Fixed in Version0.9.27 (SVN) 
Summary0014144: TPopupMenu inserted in TMainMenu works only when not popped-up standalone.
DescriptionTPopupMenu, inserted in TMainMenu, works only until the mentioned popup menu was not Popped-up programmatically in OnClick handler.

In win32 Popup menu on right mouse click continues to work, but disappears from main menu
In GTK2 Popup menu is showing as small empty rectangle at right mouse click and disappears from main menu either.

Delphi analogue works fine.

Steps To ReproduceSelect the Item "Click me" in main menu - you'll set the submenu "Layout" with 4 sub-items.

Right click the Panel1. In win32 you'll get the 4-item popup menu mentioned above.
In GTK2 you'll get empty menu.

Select the "Click me" in main menu again - you will get noting after dividing line under both Win32 and GTK2.
Additional InformationProbably the problem is in menuitem handles reference count.
TagsNo tags attached.
Fixed in Revision20859, 20862, 24179
LazTarget1.0
WidgetsetGTK 2, Win32/Win64
Attached Files

Relationships

related to 0015614 closedPaul Ishenin TPopupMenu.Close() need rework 

Activities

2009-07-14 13:16

 

laztest35.zip (226,950 bytes)

Paul Ishenin

2009-07-15 05:35

manager   ~0029105

Win32 part is fixed in r20858. I will check how to fix gtk2.

Paul Ishenin

2009-07-15 09:31

manager   ~0029109

Please test both issues and close if ok.

Anton Kavalenka

2009-07-15 12:33

reporter   ~0029111

Thank You!
Works for both platforms.

Anton Kavalenka

2010-03-22 14:29

reporter   ~0035909

Exactly the same bug in r24167

Paul Ishenin

2010-03-22 14:59

manager   ~0035912

Can you look when it became broken?

Zeljan Rikalo

2010-03-22 15:32

developer   ~0035914

It works ok here r.24169

Zeljan Rikalo

2010-03-22 15:41

developer   ~0035916

hm, but something else is wrong here.
First radio item is disabled ??? Under qt works correct.

Anton Kavalenka

2010-03-22 16:22

reporter   ~0035917

Just rolling back popupmenu.inc to 23584 resolves problem

Zeljan Rikalo

2010-03-22 16:25

developer   ~0035918

@Anton, but why popupmenu.inc ? only gtk2 isn't correct afaik ...

Anton Kavalenka

2010-03-22 16:32

reporter   ~0035919

@Zeljan
1-st menu item disabled
3-rd checked in OnClick handler

Zeljan Rikalo

2010-03-22 16:40

developer   ~0035920

I see that, what about win32. Is there ok ? r U on irc maybe ?

Zeljan Rikalo

2010-03-22 16:56

developer   ~0035921

FYI, rolling back popupmenu.inc to 23584 shows same problem under gtk2 here.
1st item disabled
3rd checked.

Anton Kavalenka

2010-03-22 17:04

reporter   ~0035922

Last edited: 2010-03-22 17:42

Both Win32 and GTK2 broken.

Disabled and checked items in menu are programmed intentionally, just for test.
See the source code.

Zeljan Rikalo

2010-03-22 19:12

developer   ~0035925

ok, now I see, qt doesn't trigger if menu root clicked so never reached 1st disabled and 3rd checked

2010-03-22 19:53

 

14144patchfortest.diff (527 bytes)   
Index: lcl/include/popupmenu.inc
===================================================================
--- lcl/include/popupmenu.inc	(revision 24173)
+++ lcl/include/popupmenu.inc	(working copy)
@@ -81,8 +81,9 @@
   if Items.Count=0 then exit;
   ActivePopupMenu:=Self;
   Items.InitiateActions;
-  DestroyHandle;
-  CreateHandle;
+  //DestroyHandle;
+  if not HandleAllocated then
+    CreateHandle;
   if Assigned(OnMenuPopupHandler) then OnMenuPopupHandler(Self);
   TWSPopupMenuClass(WidgetSetClass).Popup(Self, X, Y);
 end;
14144patchfortest.diff (527 bytes)   

Zeljan Rikalo

2010-03-22 19:55

developer   ~0035929

That attached patch is for my testing purposes only.
gtk2 + qt works perfect with it, now need win32 test.
That patch fixes only this case ! , I'm not sure what it implies or what's broken with it.
But anyway would be nice if someone explain why we call DestroyHandle each time when TPopupMenu.Popup() is called.Isn't enough to create handle once ?

Anton Kavalenka

2010-03-22 20:02

reporter   ~0035930

Your patch works OK in win32!

Zeljan Rikalo

2010-03-22 20:08

developer   ~0035932

Yes, I see (just tested) :) (but don't know if something is broken (because I don't know why we destroy popupmenu handles (before in DoClose, now in Popup()) with such patch, so won't commit until concept confirmed by more developers)

Anton Kavalenka

2010-03-22 20:14

reporter   ~0035933

Maybe the problem were in sharing single menu across several forms, so deleting the handle was necessary.
I just tested sharing TPopupMenu across 2 forms, all works fine.

Zeljan Rikalo

2010-03-22 20:19

developer   ~0035934

Let's wait until Paul wakes up :)

Anton Kavalenka

2010-03-22 20:26

reporter   ~0035935

I know :)
I'm UTC+2
Paul is UTC+8

Zeljan Rikalo

2010-03-22 20:26

developer   ~0035936

Last edited: 2010-03-22 20:30

hmmm...it does not work ok with qt on windows.
I think we should revert popupmenu to 23584 and introduce IntfPopupMenuClose(FItems), so it can be used instead of FItems.DestroyHandle in DoClose.

Paul Ishenin

2010-03-23 09:12

manager   ~0035967

Please test and close if ok.

Anton Kavalenka

2010-03-23 13:53

reporter   ~0035975

Works, thank you.

Issue History

Date Modified Username Field Change
2009-07-14 13:16 Anton Kavalenka New Issue
2009-07-14 13:16 Anton Kavalenka File Added: laztest35.zip
2009-07-14 13:16 Anton Kavalenka Widgetset => GTK 2, Win32/Win64
2009-07-15 05:35 Paul Ishenin LazTarget => 1.0
2009-07-15 05:35 Paul Ishenin Note Added: 0029105
2009-07-15 05:35 Paul Ishenin Status new => acknowledged
2009-07-15 05:35 Paul Ishenin Target Version => 1.0.0
2009-07-15 05:36 Paul Ishenin Fixed in Revision => 20859
2009-07-15 09:31 Paul Ishenin Fixed in Revision 20859 => 20859, 20862
2009-07-15 09:31 Paul Ishenin Status acknowledged => resolved
2009-07-15 09:31 Paul Ishenin Fixed in Version => 0.9.27 (SVN)
2009-07-15 09:31 Paul Ishenin Resolution open => fixed
2009-07-15 09:31 Paul Ishenin Assigned To => Paul Ishenin
2009-07-15 09:31 Paul Ishenin Note Added: 0029109
2009-07-15 12:33 Anton Kavalenka Status resolved => closed
2009-07-15 12:33 Anton Kavalenka Note Added: 0029111
2010-03-22 14:29 Anton Kavalenka Status closed => assigned
2010-03-22 14:29 Anton Kavalenka Resolution fixed => reopened
2010-03-22 14:29 Anton Kavalenka Note Added: 0035909
2010-03-22 14:59 Paul Ishenin Note Added: 0035912
2010-03-22 15:32 Zeljan Rikalo Note Added: 0035914
2010-03-22 15:41 Zeljan Rikalo Note Added: 0035916
2010-03-22 16:22 Anton Kavalenka Note Added: 0035917
2010-03-22 16:25 Zeljan Rikalo Note Added: 0035918
2010-03-22 16:32 Anton Kavalenka Note Added: 0035919
2010-03-22 16:40 Zeljan Rikalo Note Added: 0035920
2010-03-22 16:56 Zeljan Rikalo Note Added: 0035921
2010-03-22 17:04 Anton Kavalenka Note Added: 0035922
2010-03-22 17:42 Anton Kavalenka Note Edited: 0035922
2010-03-22 19:12 Zeljan Rikalo Note Added: 0035925
2010-03-22 19:53 Zeljan Rikalo File Added: 14144patchfortest.diff
2010-03-22 19:55 Zeljan Rikalo Note Added: 0035929
2010-03-22 20:02 Anton Kavalenka Note Added: 0035930
2010-03-22 20:08 Zeljan Rikalo Note Added: 0035932
2010-03-22 20:14 Anton Kavalenka Note Added: 0035933
2010-03-22 20:19 Zeljan Rikalo Note Added: 0035934
2010-03-22 20:26 Anton Kavalenka Note Added: 0035935
2010-03-22 20:26 Zeljan Rikalo Note Added: 0035936
2010-03-22 20:30 Zeljan Rikalo Note Edited: 0035936
2010-03-22 21:24 Zeljan Rikalo Relationship added related to 0015614
2010-03-23 09:12 Paul Ishenin Fixed in Revision 20859, 20862 => 20859, 20862, 24179
2010-03-23 09:12 Paul Ishenin Status assigned => resolved
2010-03-23 09:12 Paul Ishenin Resolution reopened => fixed
2010-03-23 09:12 Paul Ishenin Note Added: 0035967
2010-03-23 13:53 Anton Kavalenka Status resolved => closed
2010-03-23 13:53 Anton Kavalenka Note Added: 0035975