SegFault on C++ Desktop::create(), SDK4.2 on Linux x64

Java, C++, C#, Delphi, ??? - Using the UNO bridges

SegFault on C++ Desktop::create(), SDK4.2 on Linux x64

Postby crimaniak » Wed Aug 27, 2014 1:21 am

Hi all!

I have simple C++ application using background instance of LibreOffice to open documents and convert it to PDF format. It works under Windows x32 and Linux x32 (Ubuntu 14.04) but fails on CentOS 5.9 x64 version. I tried both sets LibreOffice 4.2.6 + LibreOffice SDK 4.2.6 and LibreOffice 4.3.0 + LibreOffice SDK 4.3.0 with the same result. Compiler used for Linux is GCC 4.6.4 for both cases. I have segmentation fault inside of Desktop::create() call. I expect to have exception derived from com::sun::star::uno::Exception in the case of connection problem or misusing so it seems to be UNO bug, but I don't sure. I am novice in UNO usage and Linux debugging so I don't sure how to solve this problem. I am sticked on this problem now :crazy: , so any help will be appreciated.

Piece of problematic code. Segfault on line with Desktop::create()
Code: Select all   Expand viewCollapse view
   Reference < XDesktop2 > Connection::create_loader(const rtl::OUString& connectionString)
   {
      try{
         // create the initial component context
         Reference< XComponentContext > rComponentContext = defaultBootstrap_InitialComponentContext();

         // retrieve the servicemanager from the context
         Reference< XMultiComponentFactory > rServiceManager = rComponentContext->getServiceManager();

         // instantiate a sample service with the servicemanager.
         Reference< XInterface > rInstance = rServiceManager->createInstanceWithContext(
            OUString("com.sun.star.bridge.UnoUrlResolver"),
            rComponentContext );

         // Query for the XUnoUrlResolver interface
         Reference< XUnoUrlResolver > rResolver( rInstance, UNO_QUERY );
         checkIt(rResolver, "Error: Couldn't instantiate com.sun.star.bridge.UnoUrlResolver service");

         Reference< XComponentContext > xContext;
         xContext.set(rResolver->resolve( connectionString ), UNO_QUERY_THROW  );
         checkIt(xContext, "No component context exported");

         Reference <XDesktop2> retval=Desktop::create(xContext);
         checkIt(retval, "XDesktop is not exported");

         return retval;

      }
      catch( Exception & e){
         // some error processing is here...
      }
   }


Stack traces:
==22052== Invalid read of size 8
==22052== at 0xA4BC8A5: cpp_vtable_call (in /perforce/ThirdParty/LibreOfficeSDK/4.2/linux64/ure-lib/libgcc3_uno.so)
==22052== by 0xA4C37AD: privateSnippetExecutor (in /perforce/ThirdParty/LibreOfficeSDK/4.2/linux64/ure-lib/libgcc3_uno.so)
==22052== by 0x4F68CB: com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>::set(com::sun::star::frame::XDesktop2*) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F628E: com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>::operator=(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F4EE1: com::sun::star::frame::Desktop::create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F31A2: com::accusoft::uno::Connection::create_loader(rtl::OUString const&) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4EB965: com::accusoft::uno::Connection::Connection(int) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4EB5A0: office_conversion_service::initialize_engines(logger::task_logger&) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F8C79: pcc_service_impl::initialize() (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F9055: pcc_service_impl::run_console_handler() (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F8526: pcc_service_impl::main(int, char**) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F93A8: pcc_service_base::main(int, char**) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)

==22052== Address 0x2400000009 is not stack'd, malloc'd or (recently) free'd
==22052==
==22052==
==22052== Process terminating with default action of signal 11 (SIGSEGV)
==22052== Access not within mapped region at address 0x2400000009
==22052== at 0xA4BC8A5: cpp_vtable_call (in /perforce/ThirdParty/LibreOfficeSDK/4.2/linux64/ure-lib/libgcc3_uno.so)
==22052== by 0xA4C37AD: privateSnippetExecutor (in /perforce/ThirdParty/LibreOfficeSDK/4.2/linux64/ure-lib/libgcc3_uno.so)
==22052== by 0x4F68CB: com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>::set(com::sun::star::frame::XDesktop2*) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F628E: com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>::operator=(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F4EE1: com::sun::star::frame::Desktop::create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F31A2: com::accusoft::uno::Connection::create_loader(rtl::OUString const&) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4EB965: com::accusoft::uno::Connection::Connection(int) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4EB5A0: office_conversion_service::initialize_engines(logger::task_logger&) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F8C79: pcc_service_impl::initialize() (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F9055: pcc_service_impl::run_console_handler() (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F8526: pcc_service_impl::main(int, char**) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)
==22052== by 0x4F93A8: pcc_service_base::main(int, char**) (in /perforce/Projects/Prizm/Services/OfficeConversionService/MAIN/Source/Build/Output/OfficeConversionService)

and this is gdb perspective

Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaff688a5 in cpp_vtable_call () from /perforce/ThirdParty/LibreOfficeSDK/4.2/linux64/ure-lib/libgcc3_uno.so
(gdb) bt
#0 0x00002aaaaff688a5 in cpp_vtable_call () from /perforce/ThirdParty/LibreOfficeSDK/4.2/linux64/ure-lib/libgcc3_uno.so
#1 0x00002aaaaff6f7ae in privateSnippetExecutor () from /perforce/ThirdParty/LibreOfficeSDK/4.2/linux64/ure-lib/libgcc3_uno.so
#2 0x00000000004f68cc in com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>::set(com::sun::star::frame::XDesktop2*) ()
#3 0x00000000004f628f in com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>::operator=(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&) ()
#4 0x00000000004f4ee2 in com::sun::star::frame::Desktop::create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) ()
#5 0x00000000004f31a3 in com::accusoft::uno::Connection::create_loader(rtl::OUString const&) ()
#6 0x00000000004eb966 in com::accusoft::uno::Connection::Connection(int) ()
#7 0x00000000004eb5a1 in office_conversion_service::initialize_engines(logger::task_logger&) ()
#8 0x00000000004f8c7a in pcc_service_impl::initialize() ()
#9 0x00000000004f9056 in pcc_service_impl::run_console_handler() ()
#10 0x00000000004f8527 in pcc_service_impl::main(int, char**) ()
#11 0x00000000004f93a9 in pcc_service_base::main(int, char**) ()
#12 0x00000000004eaf4e in main ()


So we have a problem in Reference::set() (sdk/include/com/sun/star/uno/Reference.hxx line 217).
LibreOffice 4.2 on Ubuntu 14.04
crimaniak
 
Posts: 1
Joined: Wed Aug 27, 2014 12:37 am

Return to External Programs

Who is online

Users browsing this forum: No registered users and 3 guests