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

Bug 488739

Summary: [Windows 10] Tray item icon is duplicated in some conditions
Product: [Eclipse Project] Platform Reporter: qiulin <qiulin>
Component: SWTAssignee: Niraj Modi <niraj.modi>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: arunkumar.thondapu, ashw.kumar, daniel_megert, malaperle, niraj.modi, peter, saurav.sarkar1
Version: 3.7.2   
Target Milestone: 4.6 M6   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/67897
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=61ab7c50fa5643888ae6d099f8948f3ceb5b80a8
Whiteboard:
Bug Depends on:    
Bug Blocks: 493795    
Attachments:
Description Flags
sample plugin
none
the menu to run the sample plugin
none
duplicated icons demonstrated by the sample none

Description qiulin CLA 2016-03-01 03:27:32 EST
Created attachment 260002 [details]
sample plugin

The issue was reported by some IBM Sametime customers. They said the Sametime icon in system tray was duplicated many times. After checking the issue, I think it's a generic issue of SWT Tray component. I reported the bug as critical because our Sametime customer requests urgent fix from us.

The customer is using Windows 10. They have told me the following cases that they see multiple icons:

1. Close the lid and reopen it;
2. Change the screen resolution or scale factor.

I personally can't reproduce the issue with first approach. But I am able to regularly reproduce the bug by changing scale factor in Display setting. In Windows 10, you can set scale factor in "Settings" -> "Display" -> "Change the
size of text, apps, and other items". Slide the bar to set a different scale factor which is greater than 100%. Do not log out. You will see an existing tray icon is duplicated by itself. Each time when you change to a new scale factor, a new copy of the icon will be created. These icons will not disappear if you hover the mouse upon them. They stay in the system tray till the application quits. But they are not operational at all, irresponsible to your click or right click.

I created a sample plugin to demonstrate the issue. The plugin can be launched in Eclipse IDE. I tried with Eclipse 3.7.2 and the latest Eclipse 4.5.2. Both versions have the same issue. The 3.7.2 is what Sametime based on and the target for this ticket.
Comment 1 qiulin CLA 2016-03-01 03:28:34 EST
Created attachment 260003 [details]
the menu to run the sample plugin
Comment 2 qiulin CLA 2016-03-01 03:29:31 EST
Created attachment 260004 [details]
duplicated icons demonstrated by the sample
Comment 3 qiulin CLA 2016-03-01 04:13:52 EST
Please note, there are other situations that may cause the issue, such as awake from standby (close and reopen the lid). As I can't personally reproduce in such case, I don't know if it shares the same cause as changing the scale factor.
Comment 4 Arun Thondapu CLA 2016-03-01 04:49:58 EST
I'm assuming this is a problem seen only on Windows 10, can you confirm whether the same scenarios work on Windows 7/8.1 as expected?

I have targeted to fix in 4.6 but it may be a while before we can start investigating this as we're currently busy with feature work scheduled for 4.6 M6 (which is in another 2.5 weeks approximately).
Comment 5 qiulin CLA 2016-03-01 09:19:04 EST
Hi Arun,

Only Windows 10 allows you to change the scale factor without immediate logout. For Windows 7/8/8.1, you must logout to take effect and the application is forced to quit and icons are removed.

Changing scale factor is one of the tricks to get duplicated icons. This is not a typical customer's daily scenario. They often see the issue after awake from standby. But I can't reproduce in such case at my end. So I suggest developers to investigate the issue with the approach of changing scale factor. If the cause is identified, we can evaluate if awake from standby will also be fixed. But if you can reproduce the issue with other approach, it will be nice.
Comment 6 Arun Thondapu CLA 2016-03-02 01:58:29 EST
(In reply to qiulin from comment #5)
> Hi Arun,
> 
> Only Windows 10 allows you to change the scale factor without immediate
> logout. For Windows 7/8/8.1, you must logout to take effect and the
> application is forced to quit and icons are removed.
> 
> Changing scale factor is one of the tricks to get duplicated icons. This is
> not a typical customer's daily scenario. They often see the issue after
> awake from standby. But I can't reproduce in such case at my end. So I
> suggest developers to investigate the issue with the approach of changing
> scale factor. If the cause is identified, we can evaluate if awake from
> standby will also be fixed. But if you can reproduce the issue with other
> approach, it will be nice.

Thanks for the clarifications!

Niraj, can you please try the scenarios on Windows 10 and check?
Comment 7 saurav sarkar CLA 2016-03-04 04:05:57 EST
Hi All,

Our users are facing the same issue.

Some scenarios where this issue is reproducible

(a) Closing of lid and opening (sleep of computer)
(b) Putting the laptop and taking it out from docking station
(c) Changing the scaling factor as mentioned. (Personally i could only reproduce this one).

I was already following up this issue with Microsoft.
It can be seen here

https://social.msdn.microsoft.com/Forums/en-US/07be522c-2ee0-46d3-adff-58de137142d4/shellnotifyiconw-producing-multiple-icons-in-windows-10?forum=windowsgeneraldevelopmentissues&prof=required

Post on eclipse forum
https://www.eclipse.org/forums/index.php/t/1074333/

In addition to that i have already floated the question on SWT plarform developer mailing list

Please note that this a very critical issue for us as the tray/notification area has becomes completely unusable.
As more and more user over the world are moving to Windows 10 , i feel this becomes a very critical issue.

It would be great if this issue can be taken on priority and solved urgently.

If not at least a workaround for this issue will be really helpful.

Will be willing to help in testing the patch.

Let me know if you need any further information from my side.

Thanks and Regards,
Saurav
Comment 8 Niraj Modi CLA 2016-03-04 07:27:51 EST
(In reply to Arun Thondapu from comment #6)
> (In reply to qiulin from comment #5)
> Niraj, can you please try the scenarios on Windows 10 and check?
Tried changing the display scale factor(without log-off) which is now possible on Win10, I can see the SWT tray items getting duplicated, I tested with Snippet225 and Snippet143.
Will investigate this issue further.
Comment 9 Niraj Modi CLA 2016-03-07 01:09:10 EST
As per MSDN OS.NIM_ADD should be call only once during TrayItem creation and iconData.uID value is unique for every TrayItem instance, which should be cached and used in subsequent calls to Shell_NotifyIcon to perform later actions on the TrayItem instance.
SWT TrayItem.java class need to be fixed for above mention guideline, will share a fix-patch on this issue shortly.
Comment 10 saurav sarkar CLA 2016-03-07 01:42:47 EST
Hi Niraj,

Thanks for your investigation.

But isn't the Id already reused during the icon modification i.e. the one which is created during the initial creation of the tray item widget ?

And any inputs on why this stopped working on Windows 10 ?

cheers,

Saurav
Comment 11 Eclipse Genie CLA 2016-03-07 09:25:31 EST
New Gerrit change created: https://git.eclipse.org/r/67897
Comment 12 Niraj Modi CLA 2016-03-07 09:46:21 EST
(In reply to saurav sarkar from comment #10)
> Hi Niraj,
> 
> Thanks for your investigation.
> 
> But isn't the Id already reused during the icon modification i.e. the one
> which is created during the initial creation of the tray item widget ?
There were quite a few problems in the current code.. please refer gerrit fix-patch in comment 11.

> And any inputs on why this stopped working on Windows 10 ?
This issue should have shown up in OS prior to Win10 as well.. May be some underlying OS level bug in Windows would have hidden this issue till now and it got fix in Win10.
Comment 13 saurav sarkar CLA 2016-03-07 10:25:31 EST
Hi Niraj,

Thanks for your inputs.

Would like to know  if we will we get the fix in older releases ? We are on 4.3.

cheers,
Saurav
Comment 15 Niraj Modi CLA 2016-03-09 05:26:45 EST
(In reply to Eclipse Genie from comment #14)
> Gerrit change https://git.eclipse.org/r/67897 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=61ab7c50fa5643888ae6d099f8948f3ceb5b80a8
Resolving.. this patch fixes the root cause of the problem tested by changing the scale-factor in Win10.
Comment 16 Niraj Modi CLA 2016-03-09 05:33:08 EST
(In reply to saurav sarkar from comment #13)
> Would like to know  if we will we get the fix in older releases ? We are on
> 4.3.
There would be no more 4.3.x build from Eclipse end.(even if we back-port to 4.3 branch you will have to apply at your end.)

Suggest to move to 4.6 release will be out mid 2016.
Comment 17 saurav sarkar CLA 2016-03-09 20:01:30 EST
thanks for your replies and quick fix provided.

Also request you to if at least the patch could be made to 4.5 apart from 4.6.

Because we can only consume properly released versions.

Can you please provide the dates from 4.6 M6 and if released to the 4.5 versions.

Regards,
Saurav
Comment 18 saurav sarkar CLA 2016-03-11 09:08:36 EST
Also would like to know from where i can get the fixed jar which contains the current commit and test it.
Comment 19 Niraj Modi CLA 2016-03-11 09:26:28 EST
(In reply to saurav sarkar from comment #17)
> thanks for your replies and quick fix provided.
> 
> Also request you to if at least the patch could be made to 4.5 apart from
> 4.6.
> 
> Because we can only consume properly released versions.
> 
> Can you please provide the dates from 4.6 M6 and if released to the 4.5
> versions.
4.5.2 was out recently in Feb,2016.. and there would be no more 4.5 series builds.
4.6 M6 will be out next week Thursday/Friday.

(In reply to saurav sarkar from comment #18)
> Also would like to know from where i can get the fixed jar which contains
> the current commit and test it.
You can use latest I-build from below location:
http://download.eclipse.org/eclipse/downloads/drops4/I20160308-0800/#SWT
Comment 20 Niraj Modi CLA 2016-03-15 10:15:58 EDT
Verified in I20160314-2000
Comment 21 saurav sarkar CLA 2016-03-20 22:57:46 EDT
I confirm that its working fine in our application.

Have one question regarding milestone builds

Are milestone builds stable and well tested enough to be consumed by productive applications ? Are there any productive applications which consume milestone builds ?

Regards,
Saurav
Comment 22 Niraj Modi CLA 2016-03-21 10:42:47 EDT
(In reply to saurav sarkar from comment #21)
> I confirm that its working fine in our application.
> 
> Have one question regarding milestone builds
> 
> Are milestone builds stable and well tested enough to be consumed by
> productive applications ? Are there any productive applications which
> consume milestone builds ?
> 
> Regards,
> Saurav

Hi Dani,
Please advice/guide Saurav on this, as he intends to consume 4.6 M6 build for production use.
Comment 23 Dani Megert CLA 2016-03-22 11:39:48 EDT
(In reply to saurav sarkar from comment #21)
> Are milestone builds stable and well tested enough to be consumed by
> productive applications ?

No.


> Are there any productive applications which
> consume milestone builds ?

I hope not ;-).


This might be an option for you: https://lts.eclipse.org/

If not, and if you can't wait until Neon ships in June, you could try to patch the Mars.2 SWT JAR with the TrayItem fix. However, you'd have to remove the signing from it.
Comment 24 saurav sarkar CLA 2016-03-23 06:35:00 EDT
Thanks Dani for your inputs.

I will explore the options mentioned by you.

But is it possible to provide a separate release for SWT only which contain this fix and probably other fixes too. ?

We need this fix because our users are not able to work at all in Windows 10.

Best Regards,
Saurav
Comment 25 Dani Megert CLA 2016-03-23 07:35:02 EDT
(In reply to saurav sarkar from comment #24)
> Thanks Dani for your inputs.
> 
> I will explore the options mentioned by you.
> 
> But is it possible to provide a separate release for SWT only which contain
> this fix and probably other fixes too. ?

No. Mars.2 was the last minor release for Mars.
Comment 26 saurav sarkar CLA 2016-03-23 09:07:17 EDT
Yes,so is it possible to release out of the eclipse release train ?..'.as in only releasing SWT project....
Comment 27 Dani Megert CLA 2016-03-23 09:28:31 EDT
(In reply to saurav sarkar from comment #26)
> Yes,so is it possible to release out of the eclipse release train ?..'.as in
> only releasing SWT project....

There is no release until Neon ships. You would have to craft your own SWT plug-in.