problems with static WeakReference when comphelper is in libmerged

Matúš Kukan matus.kukan at gmail.com
Mon Nov 23 11:52:15 PST 2015


Hi there,

I was looking again at adding comphelper to libmerged and found that
only problem visible in tests is caused by static
WeakReference<XFrame2> m_xCloserFrame from
framework/source/services/frame.cxx
I am getting crashes at exit like below:

#0  0xffffffff in TYPELIB_DANGER_GET(typelib_TypeDescription**,
typelib_TypeDescriptionReference*) (ppMacroTypeDescr=0xbfff6524,
pMacroTypeRef=0x85c8b70) at
/home/matus/git/master/include/typelib/typedescription.h:1008
#1  0xffffffff in uno_type_sequence_construct(uno_Sequence**,
typelib_TypeDescriptionReference*, void*, sal_Int32, uno_AcquireFunc)
(ppSequence=0xbfff65d8, pType=0x85c8b70, pElements=0x0, len=17,
acquire=0xb708a4a0 <com::sun::star::uno::cpp_acquire(void*)>)
    at /home/matus/git/master/cppu/source/uno/sequence.cxx:695
#2  0xffffffff in
com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>
>::Sequence(long) (this=0xbfff65d8, len=17) at
/home/matus/git/master/include/com/sun/star/uno/Sequence.hxx:89
#3  0xffffffff in
cppu::sequenceRemoveElementAt(com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>
>&, long) (rSeq=uno::Sequence of length 18 = {...}, index=14) at
/home/matus/git/master/cppuhelper/source/interfacecontainer.cxx:54
#4  0xffffffff in
cppu::OInterfaceContainerHelper::removeInterface(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>
const&) (this=0x86b1f5c, rListener=uno::Reference to
(com::sun::star::uno::OWeakRefListener *) 0x86c38a0)
    at /home/matus/git/master/cppuhelper/source/interfacecontainer.cxx:255
#5  0xffffffff in
cppu::OWeakConnectionPoint::removeReference(com::sun::star::uno::Reference<com::sun::star::uno::XReference>
const&) (this=0x86b1f50, rRef=uno::Reference to
(com::sun::star::uno::OWeakRefListener *) 0x86c38a0) at
/home/matus/git/master/cppuhelper/source/weak.cxx:166
#6  0xffffffff in com::sun::star::uno::WeakReferenceHelper::clear()
(this=0xb6e82600 <(anonymous namespace)::Frame::m_xCloserFrame>)
    at /home/matus/git/master/cppuhelper/source/weak.cxx:443
#7  0xffffffff in
com::sun::star::uno::WeakReferenceHelper::~WeakReferenceHelper()
(this=0xb6e82600 <(anonymous namespace)::Frame::m_xCloserFrame>)
    at /home/matus/git/master/cppuhelper/source/weak.cxx:482
#8  0xffffffff in
com::sun::star::uno::WeakReference<com::sun::star::frame::XFrame2>::~WeakReference()
(this=0xb6e82600 <(anonymous namespace)::Frame::m_xCloserFrame>) at
/home/matus/git/master/include/cppuhelper/weakref.hxx:122
#9  0xffffffff in __run_exit_handlers (status=status at entry=0,
listp=0xb7d063c4 <__exit_funcs>,
run_list_atexit=run_list_atexit at entry=true)
    at exit.c:82
#10 0xffffffff in __GI_exit (status=0) at exit.c:104
#11 0xffffffff in __libc_start_main (main=0x804af00 <main(int,
char**)>, argc=22, argv=0xbfff6864, init=
    0x8058920 <__libc_csu_init>, fini=0x8058990 <__libc_csu_fini>,
rtld_fini=0xb7fed660 <_dl_fini>, stack_end=0xbfff685c) at
libc-start.c:319
#12 0x0804ae2f in _start () at ../sysdeps/i386/start.S:115

And I would like to get help with fixing this.
There are more static WeakReferences.
I was able to work around the problem e.g. by commenting out
m_pImpl->m_XWeakConnectionPoint->removeReference in cppuhelper/source/weak.cxx

What should be done here?
1, find out why it crashes and fix the problem? I thought it would be
hard and did not try
2, Possibly this work-around solution above is acceptable?
3, kill all static WeakReferences - in the case of m_xCloserFrame,
perhaps it could be plain pointer?
4, something else?

When comphelper is in, we could add ucbhelper and i18nlangtag too.

Thanks,

Matus


More information about the LibreOffice mailing list