• Miklos Vajna's avatar
    tdf#117225 sfx2: fix leftover temp file when saving doc with embedded objects · c1676204
    Miklos Vajna yazdı
    Regression from 27938e1b (sfx2 store:
    create temp files next to local files (storage case), 2018-01-17), the
    optimization to store temp files during save next to the destination
    document (so that it can be renamed and not copied after writing the
    data successfully) causes problems when we have embedded objects.
    
    Avoid the problem by disabling this new optimization when the document
    has embedded objects.
    
    How to fix the actual root cause is not clear to me, I see that:
    
    - the SfxMedium::GetOutputStorage() call in
      SfxObjectShell::SaveTo_Impl() create a temp file
    - the SfxMedium::Commit() call in SfxObjectShell::SaveTo_Impl() tries to
      remove the file, which fails on Windows as there is an open file
      handle to that file
    - SfxObjectShell::SwitchChildrenPersistance() would close the storage,
      owning that open file handle, but it's too late
    
    So just go back to the previous behavior for now.
    
    Change-Id: I37259100d1ddf963c1f2d3b7bd9f460bc995815c
    Reviewed-on: https://gerrit.libreoffice.org/54340Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
    c1676204