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

Bug 344401

Summary: [SWT_AWT] NPE when enabling a disabled embedded shell
Product: [Eclipse Project] Platform Reporter: Christopher Deckers <chrriis>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Silenio_Quarti
Version: 3.8Flags: Silenio_Quarti: review+
Target Milestone: 3.7.2   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Simple test case showing the issue none

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?