https://bugs.documentfoundation.org/show_bug.cgi?id=172066

            Bug ID: 172066
           Summary: Calling XCloseable::close via UNO Remoting Causes a
                    Crash
           Product: LibreOffice
           Version: 26.2.3.2 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 207058
  --> https://bugs.documentfoundation.org/attachment.cgi?id=207058&action=edit
C++ sample program with CMake project to demonstrate crash

Calling XCloseable::close on a Writer document from another application will
cause LibreOffice 26.2.3.2 to crash and generate a crash dump on Windows 11
24H2. This was still possible with version 25.8.6.2. The following C++ sample
code will trigger the crash:

#include <sal/main.h>
#include <cppuhelper/bootstrap.hxx>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <iostream>

using namespace com::sun::star;
using namespace com::sun::star::uno;

SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
{
        try
        {
                Reference<XComponentContext> context = cppu::bootstrap();
                Reference<lang::XMultiComponentFactory> smgr =
context->getServiceManager();

                Reference<frame::XComponentLoader> loader(
                       
smgr->createInstanceWithContext("com.sun.star.frame.Desktop", context),
                        UNO_QUERY);

                auto doc = loader->loadComponentFromURL(
                       
rtl::OUString::createFromAscii("private:factory/swriter"),
                        rtl::OUString::createFromAscii("_blank"),
                        0,
                        Sequence<beans::PropertyValue>());

                // Calling close with LibreOffice 24.2.6.2 and 25.8.6.2 works
and the program will
                // terminate successfully. Calling close with LibreOffice
26.2.2.2 and 26.2.3.2
                // cause LibreOffice to crash and generate a crash dump.
                Reference<util::XCloseable> closeable(doc, UNO_QUERY);
                if (closeable.is())
                        closeable->close(true);

                Reference<frame::XDesktop> desktop(loader, UNO_QUERY);
                if (desktop.is())
                        desktop->terminate();
        }
        catch (Exception& e)
        {
                std::cerr << "UNO Exception occurred: " << std::endl;
                return 1;
        }
        return 0;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to