Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344401 - [SWT_AWT] NPE when enabling a disabled embedded shell
Summary: [SWT_AWT] NPE when enabling a disabled embedded shell
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.8   Edit
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Target Milestone: 3.7.2   Edit
Assignee: Lakshmi P Shanmugam CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-01 11:05 EDT by Christopher Deckers CLA
Modified: 2012-01-12 11:24 EST (History)
1 user (show)

See Also:
Silenio_Quarti: review+


Attachments
Simple test case showing the issue (2.84 KB, application/octet-stream)
2011-05-01 11:06 EDT, Christopher Deckers CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Deckers CLA 2011-05-01 11:05:45 EDT
Build Identifier: SWT 3.7M7

Shell.setEnabled(enable) has this code:
if (enabled && window.isMainWindow())

window can be null for embedded case and should be taken into account. Being able to disable the control hierarchy (and not setEnabled on the control itself) is a useful capability which is working on other SWT ports. I may be wrong but I think this is a regression for the Mac port.

Reproducible: Always

Steps to Reproduce:
1. disable an embedded shell
2. enable it
-> NPE
Comment 1 Christopher Deckers CLA 2011-05-01 11:06:47 EDT
Created attachment 194452 [details]
Simple test case showing the issue
Comment 2 Christopher Deckers CLA 2012-01-02 12:07:31 EST
Anyone to help?

I have a certain number of users hitting this bug and the fix is simply to change the test to:
if (enabled && window != null && window.isMainWindow())
Comment 3 Lakshmi P Shanmugam CLA 2012-01-04 04:05:46 EST
Its a side effect of fix for Bug 331676. 
Fixed in 3.8 by adding the missing null check. http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=b3a36839847c602b69686b1a6d73c49d37144b5d
Comment 4 Lakshmi P Shanmugam CLA 2012-01-04 04:12:50 EST
Hi Silenio, can you please review for 3.7.2?