https://issues.apache.org/ooo/show_bug.cgi?id=120458

          Priority: P3
            Bug ID: 120458
          Assignee: [email protected]
           Summary: [PyUNO] freeze on calling methods of method node of
                    Basic (basprov::BasicMethodNodeImpl)
          Severity: normal
        Issue Type: DEFECT
    Classification: Code
                OS: All
          Reporter: [email protected]
          Hardware: All
            Status: CONFIRMED
           Version: AOO 3.4.0
         Component: code
           Product: scripting

When I try to list method names in Basic module using script provider which 
can be taken from document model by css.script.provider.XScriptProviderSupplier
interface.

It seems this problem is based on NULL invocation kept by pyuno instance. 
Here is the result from gdb, first line is the result of print(method_node): 
pyuno object (com.sun.star.script.browse.XBrowseNode)0x-4f7d2bdc{,
supportedInterfaces={com.sun.star.script.browse.XBrowseNode,com.sun.star.script.XInvocation,com.sun.star.lang.XTypeProvider,com.sun.star.uno.XWeak,com.sun.star.beans.XPropertySet,com.sun.star.beans.XFastPropertySet,com.sun.star.beans.XMultiPropertySet}}

Program received signal SIGSEGV, Segmentation fault.
0x0608b91e in pyuno::PyUNO_getattr (self=0xb0c5f8b0, name=0x838fa74 "getType")
    at /mnt/hd/ooo/main/pyuno/source/module/pyuno.cxx:499
warning: Source file is more recent than executable.
499            if (me->members->xInvocation->hasMethod (attrName))
(gdb) p me
$1 = (pyuno::PyUNO *) 0xb0c5f8b0
(gdb) p me->members
$2 = (pyuno::PyUNOInternals *) 0xb0852648
(gdb) p me->members->xInvocation
$3 = {<com::sun::star::uno::BaseReference> = {
    _pInterface = 0x0}, <No data fields>}


# python macro to reproduce the problem

def create(ctx, name, args=None):
    smgr = ctx.getServiceManager()
    if args is None:
        return smgr.createInstanceWithContext(name, ctx)
    else:
        return smgr.createInstanceWithArgumentsAndContext(name, args, ctx)

def get_basic_macros_provider(ctx, context):
    return create(ctx, "com.sun.star.script.provider.ScriptProviderForBasic",
(context,))


def get_list_of_macros(sp):
    macros = []
    for lib_node in sp.getChildNodes():
        print(lib_node.getName())
        for module_node in lib_node.getChildNodes():
            print(module_node.getName())
            for method_node in module_node.getChildNodes():
                print(method_node)
                #print(dir(method_node))
                print(method_node.getType()) # segmentation fault
                #macros.append(method_node.getName(),
method_node.getPropertyValue("URI"))
    return macros

def test(*args):
    ctx = XSCRIPTCONTEXT.getComponentContext()
    doc = XSCRIPTCONTEXT.getDocument()

    #sp = get_document_basic_macros_provider(ctx, doc)
    sp = get_basic_macros_provider(ctx, "user")
    macros = get_list_of_macros(sp)
    print(macros)

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

Reply via email to