Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340005 - Windows#setDefaultModalParent() stores given value in application scope
Summary: Windows#setDefaultModalParent() stores given value in application scope
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: JFace (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P1 normal (vote)
Target Milestone: 1.4 M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-15 08:01 EDT by Rüdiger Herrmann CLA
Modified: 2011-03-17 11:29 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (2.44 KB, patch)
2011-03-17 08:54 EDT, Ivan Furnadjiev CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.