Apache OpenOffice (AOO) Bugzilla – Issue 91483
Writer crashes when inserting ole if text is hidden
Last modified: 2013-08-07 14:43:11 UTC
Here is the description for a crash bug. 1.New a writer document; 2."Format"-"Character", and select "Font Effects" tab page; 3.Check the checkbox "Hidden"; 4."Insert"-"Object"-"OLE Object", and Click "OK" in the poped up dialog. Writer crashes.
MRU->AMA: as described, when inserting an OLE into hidden text, OO crashes.
lijian->ama: I am working on this issue. Assigned to me.
Hi all, I have some findings on this issue: An OLE object is a Flyfrm whose pLower is a SwNoTxtFrm. If the SwFrm the OLE ahchors at is hidden, pLower of FlyFrm will be deleted. Method SwWrtShell::CalcAndSetScale will calculate the rect area of the object and call the method SwFEShell::FindFlyFrm to get the proper SwFlyFrm. If the SwFrm anchored is hidden, pLower will be NULL. And function SwFEShell::GetAnyCurRect will return an not exsited Rect which will cause crash. I have just got a rough solution with the attached patch, but there are still some other problems such as undo strings incorrect. But I don't know what it should be like when the anchored SwFrm is hidden when inserting an OLE object. It seems that OOo has a big defect on this. Hope someone will have a look at the patch and give some suggestions. Comments from Lijian.
Created attachment 56127 [details] patch file
First thing I notice is that there's an infinite loop in crsrsh.cxx (close to the call of CalcLayout()). Looks like your patches do not address this. I observed this in DEV300m29.
fme->lijian: Anyway: I think we should simply suppress the insertion if the cursor is currently located in a hidden paragraph. Additionally we can check if we can disable these functions in the UI in this case.
Created attachment 56340 [details] patch 2 for this issue
lijian->fme && od: Hi frank, I have disabled the insertion of crash-cause objects in the UI if the cursor is located in hidden paragraphs with the second patch. Please have a look and tell me if there is something incorrect. I didn't disable text frame/images in this case because I think they will not cause crash anyway. In fact, I think the perfect solution is to make the inserting of the OLE objects just like text frames/images even the cursor is in hidden paragraph. But I think one solution is to avoid the calling of CalcAndSetScale( xObj ) and pClient->DoVerb( SVVERB_SHOW ) if the cursor is in hidden paragraph in function SwWrtShell::InsertObject in file wrtsh1.cxx. Maybe od could give help on this, right ? Looking forward to your reply. Thank you!
fme->lijian: Thank you for your patch. Please find my comments below: [...] In fact, I think the perfect solution is to make the inserting of the OLE objects just like text frames/images even the cursor is in hidden paragraph. But I think one solution is to avoid the calling of CalcAndSetScale( xObj ) and pClient->DoVerb( SVVERB_SHOW ) if the cursor is in hidden paragraph in function SwWrtShell::InsertObject in file wrtsh1.cxx. Maybe od could give help on this, right ? [...] Well, that's the crucial point. I also prefer the perfect solution. But as I already on 2008-09-01, there's also an infinite loop in crsrsh.cxx in a current version. So there's more obviously more left to consider than simply avoiding the crash. Please switch your workspace to a more recent version and you'll see. And that's the reason why I think we might be better of with the 'simple' solution, since this issue actually only shows under some pretty rare circumstances. Your patch works fine, I'll have a look if we should also disable some other (possibly all) items in the text shell. Thank you for your good work.
lijian->fme: so is there still anything I can do for this issue ?
fme->lijian: No, thank you. I haven't yet decided if we should disable more items in the text shell in case the cursor is currently in a hidden area. So I'll take over. Thank you for your support.
For now I'll take the patch as is. We should still check if we want to disable more 'Insert' menu entries in case the cursor is located in hidden text. I set up a follow-up task for this issue: 97069.
Applied patch to textsh.cxx, cws sw31bf02.
Ready for QA.
Verified fix in CWS sw31bf02.
In issue 97069, it's about "Disable Insert menu entries if cursor is positioned in hidden text". So, for reproducing this issue, I have entered some characters in Writer and checked this issue following the steps. Indeed it has been verified in DEV310m7. Closing Li Meiying