Issue 85875 - Hang on Disposing XComponent/XDesktop
Summary: Hang on Disposing XComponent/XDesktop
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows Server 2003
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2008-02-05 09:10 UTC by noviceprogram
Modified: 2013-07-30 02:38 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description noviceprogram 2008-02-05 09:10:03 UTC

I am using OO to convert PPTs/ODPs to multiple PDFs(generating a pdf per slide 
of PPT). I use C# as my programming language. I use this utility from a 
windows service to convert PPTs to PDFs and I always make sure that OO is not 
called from multiple threads. I have written the following code to do so. but 
when ever i try to dispose/terminate some thing(such as xcomponent/xdesktop 
object) OO hangs. Please note that this code is working on Windows XP and 
problem occurs only to Win2K3. I have looked into bug 79541 as well but this 
does not help either because the hang seems like OS specific now.
I have tried using XCloseable's close as well but it also hangs.

The code follows:

XComponent xComponent = null; 
XComponentLoader xComponentLoader = null; 

// Get the component Loader for the OO. 
xComponentLoader = this.GetComponentLoader(); 

PropertyValue[] loadProps = new PropertyValue[1]; 
PropertyValue asHidden = new PropertyValue(); 
string pptPath = “file:///C:/Test.ppt”; 

asHidden.Name = "Hidden"; 
asHidden.Value = new uno.Any(true); 
loadProps[0] = asHidden; 

xComponent = xComponentLoader.loadComponentFromURL(pptPath, "_blank", 0, 
loadProps); xDrawPagesSupplier 
= (; 

// XDrawPages inherits from xDrawPages 
= xDrawPagesSupplier.getDrawPages(); 

// get the page count for standard pages 
int slideCount = xDrawPages.getCount(); 


// The following way is very slow, but i could not find a better 
// way to do this. 
for (int index = 0; index < slideCount; ++index) 

pdfOutPath += outFileName + "_" + index + ".pdf"; 
ooOutPath = ToOOURL(pdfOutPath); 

xComponent = xComponentLoader.loadComponentFromURL(pptPath, 
"_blank", 0, loadProps); 

while (xComponent == null) 
/Let the component load. 

xDrawPagesSupplier = (

// XDrawPages inherits from 
xDrawPages = xDrawPagesSupplier.getDrawPages(); 

XStorable xstorable = (XStorable)xComponent; 

// Remove all the slides except this one. 
for (int removeSlide = slideCount - 1; removeSlide >= 0; --removeSlide) 
if (removeSlide != index) 
{ removePage 
= ( 

// Remove the Slide. 

PropertyValue[] props = new PropertyValue[1]; 

props[0] = new PropertyValue(); 
props[0].Name = "FilterName"; 
props[0].Value = new uno.Any(“impress_pdf_export”); 

// Store to the given path. 
xstorable.storeToURL(ooOutPath, props); 

xComponent.dispose();  // This line causes problem
catch (System.Exception e) 
string errorStr = "Can't Convert Using Open Office"; 

// Quit Open Office. 
((XDesktop)xComponentLoader).terminate();  // This line as well.
Comment 1 jsc 2008-02-05 12:37:27 UTC
query the XComponent or XCloseable and use close 
Comment 2 jsc 2008-02-05 12:55:53 UTC
change prio, no P1

please use default priorities if you are not sure which you have to use.
Comment 3 jsc 2008-02-05 12:57:39 UTC
jsc -> as: maybe you want to comment this issue. I would say the right approach
is to use XCloseable as mentioned before. But anyway the office shouldn't crash.
Comment 4 syoungstephen 2008-02-05 18:45:27 UTC
I have the same issue when running on Windows 2003.

Using XCloseable calls Dispose anyway, which then hangs without returning and
with no exception.
Comment 5 benzman81 2010-07-07 12:05:50 UTC
i had the same problem. If I do the disposal in a new thread, then it seems to work.

I hope that helps.


p.s.: Below the code I use.

try {
  new Thread() {
    public void run() {
catch (Exception e) {
Comment 6 Rob Weir 2013-07-30 02:38:24 UTC
Reset assignee on issues not touched by assignee in more than 1000 days.