Issue 82156 - Using SpellChecker service from Python crashes OOo
Summary: Using SpellChecker service from Python crashes OOo
Status: ACCEPTED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 2.3
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-01 21:37 UTC by finngruwierlarsen
Modified: 2013-07-30 02:42 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description finngruwierlarsen 2007-10-01 21:37:57 UTC
Apparently is not possible to use the SpellChecker service from Python. The
following Python code makes OOo crash:

import uno
currentContext = XSCRIPTCONTEXT.getComponentContext()
smgr = currentContext.ServiceManager
spellchecker = \
smgr.createInstanceWithContext("com.sun.star.linguistic2.SpellChecker", \
currentContext)
locale = uno.getClass("com.sun.star.lang.Locale")
locale.Language = "da"
locale.Country = "DK"
spellcheckResult =  spellchecker.isValid("word", locale, ())
Comment 1 joergbudi 2007-10-02 20:00:36 UTC
Hi,

is a bug (or more exactly two bugs) in the pyuno bridge.

Technical details: ( pyuno_except.cxx, 
1. instances of PyClass_Type have no __class__ attribute and  
2. the function isInstanceOfStructOrException cant cope with objects, that don't
have a class attribute.

Bye,

Joerg


#0  0x47d0f92c in os::report_fatal_error () from
/usr/lib/SunJava2-1.4.2/jre/lib/i386/client/libjvm.so
(gdb) where
#0  0x47d0f92c in os::report_fatal_error () from
/usr/lib/SunJava2-1.4.2/jre/lib/i386/client/libjvm.so
#1  0x47d100cf in os::handle_unexpected_exception () from
/usr/lib/SunJava2-1.4.2/jre/lib/i386/client/libjvm.so
#2  0x47d13e2a in JVM_handle_linux_signal () from
/usr/lib/SunJava2-1.4.2/jre/lib/i386/client/libjvm.so
#3  0x47d12de8 in signalHandler () from
/usr/lib/SunJava2-1.4.2/jre/lib/i386/client/libjvm.so
#4  <signal handler called>
#5  0x54b17955 in PyObject_GetAttrString () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#6  0x54b179f4 in PyObject_HasAttrString () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#7  0x54abb354 in pyuno::isInstanceOfStructOrException(_object*) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpyuno.so
#8  0x54aab778 in pyuno::Runtime::pyObject2Any(pyuno::PyRef const&,
pyuno::ConversionMode) const () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpyuno.so
#9  0x54aab249 in pyuno::Runtime::pyObject2Any(pyuno::PyRef const&,
pyuno::ConversionMode) const () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpyuno.so
#10 0x54ab2315 in pyuno::PyUNO_callable_call(_object*, _object*, _object*) ()
from /local2/joerg/inst-ooo/ooo-680-m229/program/libpyuno.so
#11 0x54aec0b7 in PyObject_Call () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#12 0x54b4b633 in _PyEval_SliceIndex () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#13 0x54b4e15b in PyEval_EvalCodeEx () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#14 0x54b4e3f5 in PyEval_EvalCode () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#15 0x54b722f2 in PyRun_String () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#16 0x54b4d4d2 in _PyEval_SliceIndex () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#17 0x54b4e15b in PyEval_EvalCodeEx () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#18 0x54b4c98d in _PyEval_SliceIndex () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#19 0x54b4d830 in _PyEval_SliceIndex () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#20 0x54b4e15b in PyEval_EvalCodeEx () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#21 0x54b04458 in PyFunction_SetClosure () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#22 0x54aec0b7 in PyObject_Call () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#23 0x54af6a2e in PyMethod_New () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#24 0x54aec0b7 in PyObject_Call () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#25 0x54b476f8 in PyEval_CallObjectWithKeywords () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#26 0x54aec07a in PyObject_CallObject () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpython2.3.so.1.0
#27 0x54abee8e in pyuno::Adapter::invoke(rtl::OUString const&,
com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&,
com::sun::star::uno::Sequence<short>&,
com::sun::star::uno::Sequence<com::sun::star::uno::Any>&) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libpyuno.so
#28 0x422f141c in sequence.0 () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libgcc3_uno.so
#29 0x422f172e in sequence.0 () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libgcc3_uno.so
#30 0x422f1acd in sequence.0 () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libgcc3_uno.so
#31 0x54c7269e in component_getFactory () from
/local2/joerg/inst-ooo/ooo-680-m229/program/invocadapt.uno.so
#32 0x54c7395c in component_getFactory () from
/local2/joerg/inst-ooo/ooo-680-m229/program/invocadapt.uno.so
#33 0x422f09e1 in sequence.0 () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libgcc3_uno.so
#34 0x422f1161 in sequence.0 () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libgcc3_uno.so
#35 0x422f1e61 in sequence.0 () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libgcc3_uno.so
#36 0x47a23fd0 in non-virtual thunk to
browsenodefactory::BrowseNodeFactoryImpl::getSupportedServiceNames() () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libscriptframe.so
#37 0x464f98de in
SvxScriptSelectorDialog::GetDocTitle(com::sun::star::uno::Reference<com::sun::star::frame::XModel>
const&, rtl::OUString&) ()
   from /local2/joerg/inst-ooo/ooo-680-m229/program/libsvx680li.so
#38 0x406d0c6a in SvTreeListBox::Expand(SvLBoxEntry*) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libsvt680li.so
#39 0x464f641c in SvxScriptOrgDialog::LinkStubButtonHdl(void*, void*) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libsvx680li.so
#40 0x406ad072 in non-virtual thunk to
SvHeaderTabListBox::CreateAccessibleCell(long, unsigned short) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libsvt680li.so
#41 0x406ad159 in non-virtual thunk to
SvHeaderTabListBox::CreateAccessibleCell(long, unsigned short) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libsvt680li.so
#42 0x406d1190 in SvTreeListBox::MouseButtonDown(MouseEvent const&) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libsvt680li.so
#43 0x4026b838 in Window::doLazyDelete() () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libvcl680li.so
#44 0x4026bbbb in Window::doLazyDelete() () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libvcl680li.so
#45 0x420816d6 in X11SalFrame::HandleMouseEvent(_XEvent*) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libvclplug_gen680li.so
#46 0x4208591d in X11SalFrame::Dispatch(_XEvent*) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libvclplug_gen680li.so
#47 0x420af46f in SalX11Display::Dispatch(_XEvent*) () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libvclplug_gen680li.so
#48 0x420af59a in SalX11Display::Yield() () from
/local2/joerg/inst-ooo/ooo-680-m229/program/libvclplug_gen680li.so
Comment 2 joergbudi 2007-10-02 20:04:54 UTC
The crash will be fixed some time in future, thus the ticket remains with me.

Neverthelesse, the script is errornous, replace

locale = uno.getClass("com.sun.star.lang.Locale")

with

locale = uno.getClass("com.sun.star.lang.Locale")()

(uno.getClass() returns the class com.sun.star.lang.Locale, to create a concrete
instance it, you have to invoke it.

Bye,

Joerg
Comment 3 finngruwierlarsen 2007-10-03 16:51:37 UTC
Hi Joerg,

Thanks for looking into this problem. I must admit I don't understand much of
the technical details, but my script runs now, and that's good enough for me :-)

Finn
Comment 4 Rob Weir 2013-07-30 02:42:15 UTC
Reset assignee on issues not touched by assignee in more than 1000 days.