Bug 34465 - get rid of all calls to virtual const SfxPoolItem* Put( const SfxPoolItem&, USHORT nWhich)
Maciej Rumianowski
maciej.rumianowski at gmail.com
Wed Nov 21 23:52:20 PST 2012
Hi Bjoern,
I have hit a problem that i don't fully understand. Disabled items are
SfxVoidItem with Which 0, but inserted with different one. State of Item is
check with TYPE Macro as below
> if ( (*ppFnd)->Type() == TYPE(SfxVoidItem) )
> return SFX_ITEM_DISABLED;
>
So it just type that decides about disabled state of item. I've changed
places where conditions like
> if( !(*ppFnd)->Which() )
>
to
> if ( (*ppFnd)->ISA(SfxVoidItem) )
>
because I saw in an assert that this is used. At this moment problem
started, code compiles but fails at runtime with segfault at
itemset.cxx:313 (line like above)
I've checked with gdb that there is no method ISA, but IsA. With the
changed method to IsA code does not compile.
> (gdb) call (*ppFnd)->IsA(SfxVoidItem)
> $1 = {sal_Bool (const SfxPoolItem * const, TypeId)} 0x44980824
> <SfxPoolItem::IsA(void* (*)()) const>
> (gdb) call (*ppFnd)->ISA(SfxVoidItem)
> There is no member or method named ISA.
>
Moreover I tried the way with Type and TYPE with no success, gdb output
below:
> Program received signal SIGSEGV, Segmentation fault.
> 0x4496cb31 in SfxItemSet::~SfxItemSet (this=0xbfff51e8,
> __in_chrg=<optimized out>) at
> /home/maciej/programowanie/libreoffice/libo/svl/source/items/itemset.cxx:314
> 314 if( (*ppFnd)->Type() == TYPE(SfxVoidItem) )
> (gdb) call (*ppFnd)->Type()
> Cannot access memory at address 0xfca0f97
> (gdb) call (*ppFnd)->Which()
> $1 = 4040
> (gdb) call (SfxPoolItem *)(*ppFnd)->Type()
> Cannot access memory at address 0xfca0f97
> (gdb) ptype (*ppFnd)
> type = const class SfxPoolItem {
> private:
> sal_uLong nRefCount;
> sal_uInt16 nWhich;
> sal_uInt16 nKind;
>
> void SetRefCount(sal_uLong);
> void SetKind(sal_uInt16);
> public:
> sal_uLong AddRef(sal_uLong) const;
> private:
> sal_uLong ReleaseRef(sal_uLong) const;
> long Delete_Impl(void *);
> protected:
> SfxPoolItem(sal_uInt16);
> SfxPoolItem(const SfxPoolItem &);
> public:
> static void * CreateType(void);
> static TypeId StaticType(void);
> static sal_Bool IsOf(TypeId);
> virtual TypeId Type(void) const;
> virtual sal_Bool IsA(TypeId) const;
> ~SfxPoolItem(int);
> void SetWhich(sal_uInt16);
> sal_uInt16 Which(void) const;
> virtual int operator==(const SfxPoolItem &) const;
> int operator!=(const SfxPoolItem &) const;
> virtual int Compare(const SfxPoolItem &) const;
> virtual int Compare(const SfxPoolItem &, const IntlWrapper &) const;
> virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
> SfxMapUnit, SfxMapUnit, String &, const IntlWrapper *) const;
> virtual sal_uInt16 GetVersion(sal_uInt16) const;
> virtual bool ScaleMetrics(long, long);
> virtual bool HasMetrics(void) const;
> virtual bool QueryValue(com::sun::star::uno::Any &, sal_uInt8) const;
> virtual bool PutValue(const com::sun::star::uno::Any &, sal_uInt8);
> virtual SfxPoolItem * Create(SvStream &, sal_uInt16) const;
> virtual SvStream & Store(SvStream &, sal_uInt16) const;
> virtual SfxPoolItem * Clone(SfxItemPool *) const;
> virtual SfxPoolItem * CloneAtWhich(sal_uInt16, SfxItemPool *) const;
> sal_uLong GetRefCount(void) const;
> sal_uInt16 GetKind(void) const;
> static rtl::OUString readByteString(SvStream &);
> static void writeByteString(SvStream &, const rtl::OUString &);
> static rtl::OUString readUnicodeString(SvStream &, bool);
> static void writeUnicodeString(SvStream &, const rtl::OUString &);
> private:
> SfxPoolItem & operator=(const SfxPoolItem &);
> } *
> (gdb) call (*ppFnd)->StaticType()
> $2 = (void *(*)(void)) 0x4498077e <SfxPoolItem::CreateType()>
Thanks in advance for help :)
Maciek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20121122/f7d304b2/attachment.html>
More information about the LibreOffice
mailing list