Hi folks,
Thank Christian for providing the solution.
I have one more supplement: use const_cast<>() for
"pSdrHint->GetObject()". Otherwise the compiler would report errors.
Best regards,
Weike
Armin Le Grand 写道:
> Christian Lippka - Sun Microsystems Germany schrieb:
>
>
>> Hi All,
>>
>> looking at the stack I can now see the problem.
>> sd::GraphicObjectBar is context sensitive, this means
>> it will get created on the fly if a graphic shape
>> becomes selected and deleted as soon as the graphic
>> shape is deselected.
>>
>> There are two problems involved here. In general,
>> removing an SdrObject from the model should result
>> in automatic deselection of that SdrObject in any
>> view. Doing this in SdrEditView::ReplaceObjectAtView
>> only fixes one point. This should be done in
>>
>> SdrMarkView::SFX_NOTIFY when an HINT_OBJREMOVED is
>> notified. This make sure it is unmarked in all views.
>>
>> The second problem is in GraphicObjectBar::ExecuteFilter().
>>
>> After the call to SdrEditView::ReplaceObjectAtView, the
>> GraphicObjectbar is already deleted since ReplaceObjectAtView
>> changes the current selection. Therefore the call
>> to mpView->EndUndo crashes because mpView is no longer valid
>> as the this pointer is no longer valid inside
>> GraphicObjectBar::ExecuteFilter.
>>
>> I propose the following fix for GraphicObjectBar::ExecuteFilter()
>>
>> ...
>>
>> ::sd::View* pView = mpView;
>> pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
>> pView->EndUndo();
>> return; // must return now since this can already be deleted
>>
>> ...
>>
>> It would be nice to add the following to SdrMarkView::SFX_NOTIFY
>>
>> ...
>>
>>
>>
>>
> This is absolutely valid and i thought it is in already since i/we added
> that with ocke during the reportdesigner development. I discussed with
> him to do that in svx and to add it permanently will be\ okay. So i have
> just one suggestion: Please check if something like that is not already
> done in one of the View's many derived levels and their notify
> implementations.
> Well maybe another nitpicking one: put the constant left, please ;-)
>
>
>> if( eKind==HINT_OBJREMOVED && IsObjMarked( pSdrHint->GetObject() ) )
>> {
>> MarkObj( pSdrHint->GetObject(), GetSdrPageView(), TRUE );
>> }
>>
>> ...
>>
>> This would be correct but maybe that leads to other similar crashes. So
>> I'm not sure if this should be fixed.
>>
>> Regards,
>> Christian
>>
>> Liang Weike wrote:
>>
>>
>>
>>> Hi Christian and Andre,
>>>
>>> We added the line "MarkObj(pOldObj,&rPV,TRUE);" before
>>> "pOL->ReplaceObject(pNewObj,pOldObj->GetOrdNum());" when fixing issue
>>> 73871. And this action resulted in issue 84984. Here
>>> "MarkObj(pOldObj,&rPV,TRUE);" is just intended to *unmark* the old object.
>>>
>>> While testing issue 84984 the program crashes at
>>> "SdrEditView::EndUndo()". Now I copy the call stack here. Please take a
>>> look and help solve these problems thoroughly. Thank you.
>>>
>>> svx680mi.dll!SdrEditView::EndUndo()
>>> sd680mi.dll!sd::GraphicObjectBar::ExecuteFilter(SfxRequest & rReq={...})
>>> sd680mi.dll!SfxStubGraphicObjectBarExecuteFilter(SfxShell *
>>> pShell=0x0a7f21a0, SfxRequest & rReq={...})
>>> sfx680mi.dll!SfxDispatcher::Call_Impl(SfxShell & rShell={...}, const
>>> SfxSlot & rSlot={...}, SfxRequest & rReq={...}, unsigned char bRecord='')
>>> sfx680mi.dll!SfxDispatcher::_Execute(SfxShell & rShell={...}, const
>>> SfxSlot & rSlot={...}, SfxRequest & rReq={...}, unsigned short eCallMode=4)
>>> sfx680mi.dll!SfxBindings::Execute_Impl(SfxRequest & aReq={...}, const
>>> SfxSlot * pSlot=0x0aeab44c, SfxShell * pShell=0x0a7f21a0)
>>> sfx680mi.dll!SfxDispatchController_Impl::dispatch(const
>>> com::sun::star::util::URL & aURL={...}, const
>>> com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> &
>>> aArgs={...}, const
>>> com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener>
>>> & rListener={...})
>>> sfx680mi.dll!SfxOfficeDispatch::dispatch(const com::sun::star::util::URL
>>> & aURL={...}, const
>>> com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> &
>>> aArgs={...})
>>> fwk680mi.dll!framework::GenericToolbarController::ExecuteHdl_Impl()
>>> tl680mi.dll!Link::Call(void * pCaller=0x0a807fc8)
>>>
>>>
>>> Best regards,
>>> Weike
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>