https://bugs.documentfoundation.org/show_bug.cgi?id=96097
Bug ID: 96097
Summary: FILESAVE: Autosave or Save a copy on calc with signed
macro breaks the next save
Product: LibreOffice
Version: 5.1.0.0.beta1
Hardware: x86-64 (AMD64)
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Base
Assignee: [email protected]
Reporter: [email protected]
Created attachment 120835
--> https://bugs.documentfoundation.org/attachment.cgi?id=120835&action=edit
Test file
Overview:
After save a copy or an autosave, when you try to save, this error occurs "The
File could not be written".
Steps to Reproduce:
The document only contains an empty macro which is signed.
1) Open the document
2) Enable or disable macro (not important)
3) Save a copy or edit and wait for autosave
4) Save
Actual Results:
Impossible to save after an autosave or a save a copy
Build Date & Hardware:
Linux (4.2.0-18-generic #22-Ubuntu SMP) - 5.1 (master)
Linux (4.2.0-18-generic #22-Ubuntu SMP) - 5.0 RC
Linux (4.2.0-18-generic #22-Ubuntu SMP) - 4.4.7
Linux (4.2.0-18-generic #22-Ubuntu SMP) - 4.3.7
Windows - 4.3.7
Windows - 4.3.5
Additional Information:
The issues occurs on sfx2/source/doc/objstor.cxx:1171
try {
uno::Reference < beans::XPropertySet > xPropSet( GetStorage(),
uno::UNO_QUERY_THROW );
because (DocShell *)this -> (SfxMedium *)pMedium -> (SfxMedium_Impl *)pImp ->
(OStorage *)xStorage -> (OStorage_Impl *)m_pImpl is NULL
where (DocShell *) this->pImp->m_xDocStorage = pMedium->pImp->xStorage.
After some researchs, with bTryToPreserveScriptSignature = true (signed macro),
this is the 2 calls of pMedium->Close(); in objstor.cxx (line 1597 and 1656)
which call dispose() function of OStorage object and set
pMedium->pImp->xStorage->m_pImpl to NULL.
Deleting the 2 calls fix the issues on Lubuntu and Windows but it's maybe
improper to delete these Close calls.
So, I tried some cases to save the calc file to understand the issue:
breakpoint on SfxObjectShell::SaveTo_Impl
1) Save Ctrl+S (before autosave):
Enter in the section in objstor.cxx from line 1230 to 1262
Call DisconnectStorage_Impl, pMedium->pImp->bDisposeStorage is set to false.
So dispose() will be not called in pMedium->Close();.
After the save:
pImp->m_xDocStorage-> = pMedium (same)
pImp->m_xDocStorage->m_pImpl = (OStorage_Impl *) 0x2faf5f0
Then, no error occurs.
2) Save a copy (before autosave) or Autosave:
Enter in the section in objstor.cxx from line 1312 to 1323
No call to Disconnect so pMedium->pImp->bDisposeStorage = true
When pMedium->Close(); is called, pMedium->pImp->xStorage->m_pImpl is set to
NULL.
After save:
pImp->m_xDocStorage-> = pMedium (same)
pImp->m_xDocStorage->m_pImpl = NULL
Then, error occurs on the next save.
3) Save As (before autosave):
Enter in the section in objstor.cxx from line 1312 to 1323
No call to Disconnect so pMedium->pImp->bDisposeStorage = true
When pMedium->Close(); is called, pMedium->pImp->xStorage->m_pImpl is set to
NULL.
pImp->m_xDocStorage-> = rMedium (new SfxMedium)
pImp->m_xDocStorage->m_pImpl = NULL
Then, no error occurs on the next save because pMedium is replaced by the
target SfxMedium.
I tried to make a patch adding after (line 1660) AddLog( OSL_LOG_PREFIX
"SaveAs/Export" );
if ( bCopyTo )
{
pMedium->CanDisposeStorage_Impl( false );
}
The patch works perfectly on Lubuntu but a new error occurs on Windows :
- During a save a copy, a popup indicate that the file opened is "read only"
- After that, on saving, an error occurs in a popup "Error saving the
document. Object not accessible. The object cannot be assigned due to
insufficient user right"
I don't know if this will help you but currently I don't find why an error
occurs on Windows.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs