To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=85875
                 Issue #|85875
                 Summary|Hang on Disposing XComponent/XDesktop
               Component|api
                 Version|OOo 2.3.0 RC1
                Platform|PC
                     URL|
              OS/Version|Windows 2003
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P1
            Subcomponent|code
             Assigned to|jsc
             Reported by|noviceprogram





------- Additional comments from [EMAIL PROTECTED] Tue Feb  5 09:10:03 +0000 
2008 -------
Hello,

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; 

try 
{ 
// 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); 

unoidl.com.sun.star.drawing.XDrawPagesSupplier xDrawPagesSupplier 
= (unoidl.com.sun.star.drawing.XDrawPagesSupplier)xComponent; 

// XDrawPages inherits from com.sun.star.container.XIndexAccess 
unoidl.com.sun.star.drawing.XDrawPages xDrawPages 
= xDrawPagesSupplier.getDrawPages(); 

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

xComponent.dispose(); 

// 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. 
System.Threading.Thread.Sleep(1000); 
} 

xDrawPagesSupplier = (unoidl.com.sun.star.drawing.XDrawPagesSupplier)
xComponent; 

// XDrawPages inherits from com.sun.star.container.XIndexAccess 
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) 
{ 
unoidl.com.sun.star.drawing.XDrawPage removePage 
= (unoidl.com.sun.star.drawing.XDrawPage) 
xDrawPages.getByIndex(removeSlide).Value; 

// Remove the Slide. 
xDrawPages.remove(removePage); 
} 
} 

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"; 
} 
finally 
{ 


// Quit Open Office. 
((XDesktop)xComponentLoader).terminate();  // This line as well.
} 
[/b]

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to