[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: [calligra] libs/odf: Failing saving embedded doc made follow-up ops wrong
From:       "C. Boemann" <cbo () boemann ! dk>
Date:       2013-12-18 22:35:55
Message-ID: 2695048.FdrIxE3kYg () flapper
[Download RAW message or body]

On Wedneday 18 December 2013 20:51:17 Sebastian Sauer wrote:
> Git commit d5e206626f964cfbf66a8fffa1d63647eacae8e2 by Sebastian Sauer.
> Committed on 18/12/2013 at 20:41.
> Pushed by sebsauer into branch 'master'.
> 
> Failing saving embedded doc made follow-up ops wrong
> 
> 1. The push/pop only needs to happen when cd into a
> directory. So, move the push/pop back to where they
> where before "Improve code comment" done in
> commit 094c204e381433. Beside unneeded it also
> improved the possibility of case 2. to happen.
> 
> 2. When saving the embedded document failed the
> method was left using "return false;" without
> any pop restoring the previous pushed directory
> resulting in KoStore being from now on in the
> wrong directory and finishing writing with
> a still filled KoStore directoryStack.
> 
> M  +7    -4    libs/odf/KoEmbeddedDocumentSaver.cpp
> 
> http://commits.kde.org/calligra/d5e206626f964cfbf66a8fffa1d63647eacae8e2
> 
> diff --git a/libs/odf/KoEmbeddedDocumentSaver.cpp
> b/libs/odf/KoEmbeddedDocumentSaver.cpp index fbae6f4..4ed6e48 100644
> --- a/libs/odf/KoEmbeddedDocumentSaver.cpp
> +++ b/libs/odf/KoEmbeddedDocumentSaver.cpp
> @@ -189,7 +189,6 @@ bool
> KoEmbeddedDocumentSaver::saveEmbeddedDocuments(KoOdfDocument::SavingContext
> const QString name = doc->url().path();
>              kDebug(30003) << "saving" << name;
> 
> -            store->pushDirectory();
>              if (doc->nativeOasisMimeType().isEmpty()) {
>                  // Embedded object doesn't support OpenDocument, save in
> the old format. kDebug(30003) << "Embedded object doesn't support
> OpenDocument, save in the old format."; @@ -199,15 +198,19 @@ bool
> KoEmbeddedDocumentSaver::saveEmbeddedDocuments(KoOdfDocument::SavingContext
> }
>              } else {
>                  // To make the children happy cd to the correct directory
> +                store->pushDirectory();
>                  store->enterDirectory(name);
> 
> -                if (!doc->saveOdf(documentContext)) {
> +                bool ok = doc->saveOdf(documentContext);
> +
> +                // Now that we're done leave the directory again
> +                store->popDirectory();
> +
> +                if (!ok) {
>                      kWarning(30003) <<
> "KoEmbeddedDocumentSaver::saveEmbeddedDocuments failed"; return false;
>                  }
> -                // Now that we're done leave the directory again
>              }
> -            store->popDirectory();
> 
>              Q_ASSERT(doc->url().protocol() == INTERNAL_PROTOCOL);
>              path = store->currentDirectory();

uhm did you test that you didn't break the saveToStore codepath


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic