summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-06-14 11:22:51 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-08-20 12:28:09 +0000
commit20b937fe53d6eebf1d2546f228f9209f75612ba6 (patch)
treee206cbd3aaeef13290416e59207cad106f4b6b29
parent49e308ce893e461a121ea7d90ec9514f05bf62aa (diff)
Always try to mount in gio::Content::getGFileInfo
...and not only if the caller happens to pass in non-null ppError. Otherwise, calling soffice with a document URL handled by the gio UCP that is not yet gio-mounted would silently do nothing and exit with EXIT_SUCCESS, as the first thing the type detection code does on the URL is execute "getPropertyValues" for "IsDocument", which calls getGFileInfo with null ppError, so a void instead of a boolean value is returned, which then derails the type detection code to silently fail (which is another problem that needs fixing). Change-Id: I48a84428cdee5caead02909abc2efd3ae3722052 (cherry picked from commit 4d8bf09305fc4e4bd652187aac0a02398413ba65) Reviewed-on: https://gerrit.libreoffice.org/5537 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--ucb/source/ucp/gio/gio_content.cxx42
1 files changed, 26 insertions, 16 deletions
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index 4833a4842906..282587091dee 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -340,25 +340,35 @@ MountOperation::~MountOperation()
GFileInfo* Content::getGFileInfo(const uno::Reference< ucb::XCommandEnvironment >& xEnv, GError **ppError)
{
- /*If we don't have it already, and we're not a "pre-creation" content then query for the info"*/
- if (!mpInfo && !mbTransient)
- {
- if (!(mpInfo = g_file_query_info(getGFile(), "*", G_FILE_QUERY_INFO_NONE, NULL, ppError)))
- {
- //Try and mount if unmounted
- if (ppError && (*ppError)->code == G_IO_ERROR_NOT_MOUNTED)
- {
- g_error_free(*ppError);
-
- MountOperation aMounter(xEnv);
- *ppError = aMounter.Mount(getGFile());
-
- //No Mount error, reattempt query
- if (!*ppError)
- mpInfo = g_file_query_info(getGFile(), "*", G_FILE_QUERY_INFO_NONE, NULL, ppError);
+ GError * err = 0;
+ if (mpInfo == 0 && !mbTransient) {
+ for (bool retried = false;; retried = true) {
+ mpInfo = g_file_query_info(
+ getGFile(), "*", G_FILE_QUERY_INFO_NONE, 0, &err);
+ if (mpInfo != 0) {
+ break;
+ }
+ assert(err != 0);
+ if (err->code != G_IO_ERROR_NOT_MOUNTED || retried) {
+ break;
+ }
+ SAL_INFO(
+ "ucb.ucp.gio",
+ "G_IO_ERROR_NOT_MOUNTED \"" << err->message
+ << "\", trying to mount");
+ g_error_free(err);
+ err = MountOperation(xEnv).Mount(getGFile());
+ if (err != 0) {
+ break;
}
}
}
+ if (ppError != 0) {
+ *ppError = err;
+ } else if (err != 0) {
+ SAL_WARN("ucb.ucp.gio", "ignoring GError \"" << err->message << "\"");
+ g_error_free(err);
+ }
return mpInfo;
}