Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322122 - [OLE] Word.application does not kill WINWORD process.
Summary: [OLE] Word.application does not kill WINWORD process.
Status: CLOSED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 321000
  Show dependency tree
 
Reported: 2010-08-09 07:17 EDT by Krzysztof Kazmierczyk CLA
Modified: 2010-08-11 10:44 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Kazmierczyk CLA 2010-08-09 07:17:11 EDT
Build Identifier: I20100608-0911

Exctracted from bug 321000.
When you create and dispose "Word.Application" application component, no WINWORD process has been killed.

Reproducible: Always

Steps to Reproduce:
Run Following code:

Display display = new Display();
final Shell shell = new Shell(display);
frame = new OleFrame(shell, SWT.NONE);
for (int i = 0; i < 5; i++) {
    clientSite = new OleClientSite(frame, SWT.NONE, "Word.Application");
    clientSite.dispose();    
}

Now you see 5 WINWORD processes in your Windows.
Comment 1 Felipe Heidrich CLA 2010-08-09 14:50:10 EDT
try this:
Display display = new Display();
final Shell shell = new Shell(display);
OleFrame frame = new OleFrame(shell, SWT.NONE);
for (int i = 0; i < 5; i++) {
	OleClientSite clientSite = new OleClientSite(frame, SWT.NONE, "Word.Application");
	OleAutomation automation = new OleAutomation(clientSite);
	int id = automation.getIDsOfNames(new String[] {"Quit"})[0];
	automation.invoke(id);
	automation.dispose();
    clientSite.dispose();    
}
frame.dispose();
shell.dispose();
display.dispose();

apparently this is how word works: see http://www.ms-news.net/f3262/word-saveas-ole-container-not-killing-process-2621451.html
Comment 2 Krzysztof Kazmierczyk CLA 2010-08-11 07:16:28 EDT
(In reply to comment #1)
> try this:
> Display display = new Display();
> final Shell shell = new Shell(display);
> OleFrame frame = new OleFrame(shell, SWT.NONE);
> for (int i = 0; i < 5; i++) {
>     OleClientSite clientSite = new OleClientSite(frame, SWT.NONE,
> "Word.Application");
>     OleAutomation automation = new OleAutomation(clientSite);
>     int id = automation.getIDsOfNames(new String[] {"Quit"})[0];
>     automation.invoke(id);
>     automation.dispose();
>     clientSite.dispose();    
> }
> frame.dispose();
> shell.dispose();
> display.dispose();
> 
> apparently this is how word works: see
> http://www.ms-news.net/f3262/word-saveas-ole-container-not-killing-process-2621451.html

OK that works for me now.
Thanks Felipe :)
Should we close it as invalid?
Comment 3 Felipe Heidrich CLA 2010-08-11 10:44:44 EDT
I think so.
I double checked that SWT is releasing all OLE components.
Calling this "Quit" method is a MS Word thing, so makes sense that the application has to call it.