You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2012/08/03 18:35:58 UTC
[Bug 120458] New: [PyUNO] freeze on calling methods of method node
of Basic (basprov::BasicMethodNodeImpl)
https://issues.apache.org/ooo/show_bug.cgi?id=120458
Priority: P3
Bug ID: 120458
Assignee: ooo-issues@incubator.apache.org
Summary: [PyUNO] freeze on calling methods of method node of
Basic (basprov::BasicMethodNodeImpl)
Severity: normal
Issue Type: DEFECT
Classification: Code
OS: All
Reporter: hanya.runo@gmail.com
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.
[Bug 120458] [PyUNO] freeze on calling methods of method node of
Basic (basprov::BasicMethodNodeImpl)
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=120458
--- Comment #5 from hanya <ha...@gmail.com> ---
The attached patch should be tested on current version.
And also, it is better if pyuno and callable struct are redesigned.
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
[Bug 120458] [PyUNO] freeze on calling methods of method node of
Basic (basprov::BasicMethodNodeImpl)
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=120458
--- Comment #3 from hanya <ha...@gmail.com> ---
Created attachment 80423
--> https://issues.apache.org/ooo/attachment.cgi?id=80423&action=edit
Proposed patch to fix this problem
This patch provides fixes:
If self->members->xInvocation is not valid reference in PyUNO_new_UNCHECKED
function,
introspection mechanism is used to call method and to get property values.
To get list of methods and properties is also requires this switching.
It seems this way is used in Basic runtime.
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
[Bug 120458] [PyUNO] freeze on calling methods of method node of
Basic (basprov::BasicMethodNodeImpl)
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=120458
--- Comment #2 from hanya <ha...@gmail.com> ---
Here is the workaround:
def get_list_of_macros(ctx, sp):
introspection = create(ctx, "com.sun.star.beans.Introspection")
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():
d = None
inspected = introspection.inspect(method_node)
idl_getName = inspected.getMethod("getName", -1)
idl_getPropertyValue = inspected.getMethod("getPropertyValue",
-1)
name, d = idl_getName.invoke(method_node, ())
uri, d = idl_getPropertyValue.invoke(method_node, ("URI",))
macros.append((name, uri))
#macros.append(method_node.getName(),
method_node.getPropertyValue("URI"))
return macros
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 120458] [PyUNO] freeze on calling methods of method node of
Basic (basprov::BasicMethodNodeImpl)
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=120458
--- Comment #1 from hanya <ha...@gmail.com> ---
If target which supports css.script.XInvocation interface passed
to make invocation bridge by css.script.Invocation,
calling methods of XInvocation and XInvocation2 are delegated to the target.
basprov::BasicMethodNodeImpl implements css.script.XInvocation to execute
macros
but not for adaption use and XInvocation2 is not implemented.
In PyUNO_new_UNCHECKED, Reference<XInvocation2> tmp_invocation (tmp_interface,
UNO_QUERY);
will keep invalid reference to the interface.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 120458] [PyUNO] freeze on calling methods of method node of
Basic (basprov::BasicMethodNodeImpl)
Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=120458
--- Comment #4 from hanya <ha...@gmail.com> ---
Created attachment 80424
--> https://issues.apache.org/ooo/attachment.cgi?id=80424&action=edit
Unittest script for the attached patch
Place this python script into user's profile/Scripts/python and
execute function "execute_unittest" through Python script organizer.
The result will be shown in new Writer document.
This test uses some unittest functions introduced on Pytho 2.7, so it does not
work with Python 2.6.X.
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.