Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 479200

Summary: [GTK2][Menu] no menu item added.
Product: [Eclipse Project] Platform Reporter: Thomas Singer <eclipse>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, ericwill
Version: 4.5Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 530841    
Attachments:
Description Flags
Modified Snippet117 none

Description Thomas Singer CLA 2015-10-07 03:12:32 EDT
We have code where a Menu is filled, if nothing has been added an disabled menu item is added, e.g.

   public void fill(Menu menu) {
     doFill(menu);
     if (menu.getItemCount() == 0) {
        final MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText("Nothing");
        menuItem.setEnabled(false);
     }

     finish(menu);
   }

   private void finish(Menu menu) {
     if (menu.getItemCount() == 0) {
        throw new OurAssertException();
     }
     ...
   }

From time to time we are getting bug reports (only for Linux) that this assertion in finish() failed. Unfortunately, I don't have a reproducible snippet.
Comment 1 Eric Williams CLA 2015-10-08 09:20:09 EDT
Created attachment 257159 [details]
Modified Snippet117

I can't reproduce this issue on Gtk2 or Gtk3 -- both with Mars.1 and Neon nightly (20151001). I've attached this Snippet to indicate this.
Comment 2 Thomas Singer CLA 2015-10-08 11:35:54 EDT
The problem is not easily reproducible, otherwise we would have tons of bug reports.
Comment 3 Alexander Kurtakov CLA 2015-10-15 08:30:27 EDT
Without a working reproducer there isn't much we can do to fix such problem so please try coming with one.
Comment 4 Thomas Singer CLA 2015-10-16 02:22:03 EDT
I think, what you actually can do is to add an assertion that after adding a menu item the item count actually increased.
Comment 5 Leo Ufimtsev CLA 2018-02-07 10:20:57 EST
It's a bit not clear as to whether this is gtk2 specific or occurs on Gtk3 also.

Triaging Gtk2-only bugs. Please see Bug 530841 for details.

If this bug is not gtk2-specific, i.e, it also occurs on Gtk3, please indicate and I'll update the bug accordingly.

Thank you for your bug submission.
Comment 6 Eric Williams CLA 2018-07-10 13:57:48 EDT
Please note: GTK2 support for SWT is being dropped in Eclipse 4.10 / SimRel 2018-12 release. 

See the following mail for more info: http://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg15783.html
Comment 7 Alexander Kurtakov CLA 2018-07-12 10:15:37 EDT
Marking the bug as wontfix as no work for GTK2 issues will happen. Please reopen if you still face the issue using GTK 3.x.