Kaydet (Commit) 8568c722 authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Andras Timar

tdf#66232: Cannot open files by COM2

As suggested by comment 13 of the bug, the problem is caused
by commit b2486241 by Noel Grandin.

1. DocumentHolder::DocumentFrame(): XDesktop2 cannot be directly
queried for XFrame2. And in this case, simple XFrame is enough.

2. DocumentHolder::CloseFrame(): m_xFrame->dispose() violates an
assert because of NULL reference. Reverted to previous code.

3. Following commit debde4fd by
Andras Timar (supposed to fix the bug), found two places where
previously used to be UNO_QUERY, but now UNO_QUERY_THROW is used.
These places are reverted to use UNO_QUERY.

Change-Id: Ifb9e74367d5dd99ba12166abdd443b29a8018aeb
Reviewed-on: https://gerrit.libreoffice.org/15607Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst d1ed2f0a
......@@ -363,7 +363,7 @@ HRESULT DocumentHolder::InPlaceActivate(
LoadDocInFrame( sal_True );
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory));
xDesktop->getFrames()->append( uno::Reference<frame::XFrame>(m_xFrame, uno::UNO_QUERY_THROW) );
xDesktop->getFrames()->append( uno::Reference<frame::XFrame>(m_xFrame, uno::UNO_QUERY) );
// determine the menuhandle to get menutitems.
if(m_xLayoutManager.is()) {
......@@ -694,7 +694,9 @@ void DocumentHolder::CloseFrame()
catch( const uno::Exception& ) {
}
else {
m_xFrame->dispose();
uno::Reference<lang::XComponent> xComp(m_xFrame, uno::UNO_QUERY);
if (xComp.is())
xComp->dispose();
}
m_xFrame = uno::Reference< frame::XFrame2 >();
......@@ -770,13 +772,13 @@ uno::Reference< frame::XFrame2 > DocumentHolder::DocumentFrame()
{
uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory));
uno::Reference<frame::XFrame2> xFrame(xDesktop,uno::UNO_QUERY);
uno::Reference<frame::XFrame> xFrame(xDesktop,uno::UNO_QUERY);
// the frame will be registered on desktop here, later when the document
// is loaded into the frame in ::show() method the terminate listener will be removed
// this is so only for outplace activation
if( xFrame.is() )
m_xFrame.set( xFrame->findFrame( OUString("_blank"), 0 ), uno::UNO_QUERY_THROW );
m_xFrame.set( xFrame->findFrame( OUString("_blank"), 0 ), uno::UNO_QUERY );
uno::Reference< util::XCloseBroadcaster > xBroadcaster(
m_xFrame, uno::UNO_QUERY );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment