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

Bug 340005

Summary: Windows#setDefaultModalParent() stores given value in application scope
Product: [RT] RAP Reporter: Rüdiger Herrmann <ruediger.herrmann>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: ruediger.herrmann
Version: unspecified   
Target Milestone: 1.4 M7   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Rüdiger Herrmann CLA 2011-03-15 08:01:28 EDT
The Windows#setDefaultModalParent() has application scope as it stores the given argument in a static variable. This may cause 
a) a memory leak as the argument is likely to hold a shell that should be released upon session termination but is held forever in said static field
b) unwanted side effects as shells are mixed across session boundaries
Comment 1 Ivan Furnadjiev CLA 2011-03-17 08:54:34 EDT
Created attachment 191411 [details]
Proposed patch

This patch puts the provider set by Window#setDefaultModalParent into the session store.
Comment 2 Rüdiger Herrmann CLA 2011-03-17 09:33:52 EDT
Hi Ivan,

I just had a look at your patch. I think the defaultModalParent should also be removed because
a) it is useless as it is always null
b) it is static and there must not be any static IShellProvider
Comment 3 Ivan Furnadjiev CLA 2011-03-17 09:44:46 EDT
Hi Rüdiger, why do you think that the defaultModalParent is always null - it is initialized in the declaration? Yes, it is static, but it uses Display.getCurrent().getShells() to get the session aware modalChild.
Comment 4 Rüdiger Herrmann CLA 2011-03-17 09:56:38 EDT
Ups, I overlooked this - thought it was initialized with null, don't ask me why... Sorry for the noise.
Comment 5 Ivan Furnadjiev CLA 2011-03-17 11:29:54 EDT
Applied patch to CVS HEAD.