Blame SOURCES/0001-rhbz-1527945-segv-on-failed-open-of-password-protect.patch

91334d
From 243d94875dc9c24932c2aec5ec44cf31e310d006 Mon Sep 17 00:00:00 2001
91334d
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
91334d
Date: Thu, 21 Dec 2017 16:19:42 +0000
91334d
Subject: [PATCH] rhbz#1527945 segv on failed open of password protected doc in
91334d
 gnome-documents
91334d
91334d
Change-Id: I1bec502ae20d03214c673d8911792c89669c0fe9
91334d
Reviewed-on: https://gerrit.libreoffice.org/46923
91334d
Tested-by: Jenkins <ci@libreoffice.org>
91334d
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
91334d
(cherry picked from commit a61f45499856aad9910d82af1312a163504c15c2)
91334d
91334d
Lok: number callback enum for easier debugging
91334d
91334d
Since the entries and their order are part of the
91334d
public API, and will not change, numbering them
91334d
makes it easier to trap particular callbacks by
91334d
their number (as that's what shows in logs and
91334d
the debugger).
91334d
91334d
Change-Id: Ife2fe3e601ce3dce0939363d748fcb54d3c85fd4
91334d
Reviewed-on: https://gerrit.libreoffice.org/31257
91334d
Tested-by: Jenkins <ci@libreoffice.org>
91334d
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
91334d
(cherry picked from commit 719f7cb94ce783349fb1cf366a78edd9996d3e37)
91334d
91334d
lokdocview: use std::string where possible
91334d
91334d
This also prevents an invalid memory access: we were storing the pointer
91334d
to a temporary in the struct and then using it after temporary was gone.
91334d
91334d
Change-Id: I2b6d9df16bc24b222095ccbf45c9f0bd9c86ed65
91334d
(cherry picked from commit 9d2e0d60c0381a4bb23fada14c80e032b68bf2a8)
91334d
Reviewed-on: https://gerrit.libreoffice.org/46951
91334d
Tested-by: Jenkins <ci@libreoffice.org>
91334d
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
91334d
(cherry picked from commit 4ed5f5b28aaaf4522b71f32fb2f9f6a960dbff69)
91334d
---
91334d
 include/LibreOfficeKit/LibreOfficeKitEnums.h | 64 ++++++++++++++--------------
91334d
 libreofficekit/source/gtk/lokdocview.cxx     | 44 +++++++++----------
91334d
 2 files changed, 53 insertions(+), 55 deletions(-)
91334d
91334d
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
91334d
index 187fa9812e60..d2ccc0fdccd8 100644
91334d
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
91334d
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
91334d
@@ -93,13 +93,13 @@ typedef enum
91334d
      *
91334d
      * @see LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK.
91334d
      */
91334d
-    LOK_CALLBACK_INVALIDATE_TILES,
91334d
+    LOK_CALLBACK_INVALIDATE_TILES = 0,
91334d
     /**
91334d
      * The size and/or the position of the visible cursor changed.
91334d
      *
91334d
      * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
91334d
      */
91334d
-    LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR,
91334d
+    LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR = 1,
91334d
     /**
91334d
      * The list of rectangles representing the current text selection changed.
91334d
      *
91334d
@@ -108,7 +108,7 @@ typedef enum
91334d
      * LOK_CALLBACK_INVALIDATE_TILES. When there is no selection, an empty
91334d
      * string is provided.
91334d
      */
91334d
-    LOK_CALLBACK_TEXT_SELECTION,
91334d
+    LOK_CALLBACK_TEXT_SELECTION = 2,
91334d
     /**
91334d
      * The position and size of the cursor rectangle at the text
91334d
      * selection start. It is used to draw the selection handles.
91334d
@@ -118,7 +118,7 @@ typedef enum
91334d
      *
91334d
      * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
91334d
      */
91334d
-    LOK_CALLBACK_TEXT_SELECTION_START,
91334d
+    LOK_CALLBACK_TEXT_SELECTION_START = 3,
91334d
     /**
91334d
      * The position and size of the cursor rectangle at the text
91334d
      * selection end. It is used to draw the selection handles.
91334d
@@ -128,7 +128,7 @@ typedef enum
91334d
      *
91334d
      * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
91334d
      */
91334d
-    LOK_CALLBACK_TEXT_SELECTION_END,
91334d
+    LOK_CALLBACK_TEXT_SELECTION_END = 4,
91334d
     /**
91334d
      * The blinking text cursor is now visible or not.
91334d
      *
91334d
@@ -137,26 +137,26 @@ typedef enum
91334d
      * LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR once it becomes false. Payload is
91334d
      * either the "true" or the "false" string.
91334d
      */
91334d
-    LOK_CALLBACK_CURSOR_VISIBLE,
91334d
+    LOK_CALLBACK_CURSOR_VISIBLE = 5,
91334d
     /**
91334d
      * The size and/or the position of the graphic selection changed.
91334d
      *
91334d
      * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
91334d
      */
91334d
-    LOK_CALLBACK_GRAPHIC_SELECTION,
91334d
+    LOK_CALLBACK_GRAPHIC_SELECTION = 6,
91334d
 
91334d
     /**
91334d
      * User clicked on an hyperlink that should be handled by other
91334d
      * applications accordingly.
91334d
      */
91334d
-    LOK_CALLBACK_HYPERLINK_CLICKED,
91334d
+    LOK_CALLBACK_HYPERLINK_CLICKED = 7,
91334d
 
91334d
     /**
91334d
      * Emit state update to the client.
91334d
      * For example, when cursor is on bold text, this callback is triggered
91334d
      * with payload: ".uno:Bold=true"
91334d
      */
91334d
-    LOK_CALLBACK_STATE_CHANGED,
91334d
+    LOK_CALLBACK_STATE_CHANGED = 8,
91334d
 
91334d
     /**
91334d
      * Start a "status indicator" (here restricted to a progress bar type
91334d
@@ -172,25 +172,25 @@ typedef enum
91334d
      * loading a document and then constructing a LibreOfficeKitDocument
91334d
      * object.
91334d
      */
91334d
-    LOK_CALLBACK_STATUS_INDICATOR_START,
91334d
+    LOK_CALLBACK_STATUS_INDICATOR_START = 9,
91334d
 
91334d
     /**
91334d
      * Sets the numeric value of the status indicator.
91334d
      * The payload should be a percentage, an integer between 0 and 100.
91334d
      */
91334d
-    LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE,
91334d
+    LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE = 10,
91334d
 
91334d
     /**
91334d
      * Ends the status indicator.
91334d
      *
91334d
      * Not necessarily ever emitted.
91334d
      */
91334d
-    LOK_CALLBACK_STATUS_INDICATOR_FINISH,
91334d
+    LOK_CALLBACK_STATUS_INDICATOR_FINISH = 11,
91334d
 
91334d
     /**
91334d
      * No match was found for the search input
91334d
      */
91334d
-    LOK_CALLBACK_SEARCH_NOT_FOUND,
91334d
+    LOK_CALLBACK_SEARCH_NOT_FOUND = 12,
91334d
 
91334d
     /**
91334d
      * Size of the document changed.
91334d
@@ -198,14 +198,14 @@ typedef enum
91334d
      * Payload format is "width, height", i.e. clients get the new size without
91334d
      * having to do an explicit lok::Document::getDocumentSize() call.
91334d
      */
91334d
-    LOK_CALLBACK_DOCUMENT_SIZE_CHANGED,
91334d
+    LOK_CALLBACK_DOCUMENT_SIZE_CHANGED = 13,
91334d
 
91334d
     /**
91334d
      * The current part number is changed.
91334d
      *
91334d
      * Payload is a single 0-based integer.
91334d
      */
91334d
-    LOK_CALLBACK_SET_PART,
91334d
+    LOK_CALLBACK_SET_PART = 14,
91334d
 
91334d
     /**
91334d
      * Selection rectangles of the search result when find all is performed.
91334d
@@ -231,7 +231,7 @@ typedef enum
91334d
      * - searchResultSelection is an array of part-number and rectangle list
91334d
      *   pairs, in LOK_CALLBACK_SET_PART / LOK_CALLBACK_TEXT_SELECTION format.
91334d
      */
91334d
-    LOK_CALLBACK_SEARCH_RESULT_SELECTION,
91334d
+    LOK_CALLBACK_SEARCH_RESULT_SELECTION = 15,
91334d
 
91334d
     /**
91334d
      * Result of the UNO command execution when bNotifyWhenFinished was set
91334d
@@ -246,26 +246,26 @@ typedef enum
91334d
      *     // TODO "result": "..."  // UNO Any converted to JSON (not implemented yet)
91334d
      * }
91334d
      */
91334d
-    LOK_CALLBACK_UNO_COMMAND_RESULT,
91334d
+    LOK_CALLBACK_UNO_COMMAND_RESULT = 16,
91334d
 
91334d
     /**
91334d
      * The size and/or the position of the cell cursor changed.
91334d
      *
91334d
      * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
91334d
      */
91334d
-    LOK_CALLBACK_CELL_CURSOR,
91334d
+    LOK_CALLBACK_CELL_CURSOR = 17,
91334d
 
91334d
     /**
91334d
      * The current mouse pointer style.
91334d
      *
91334d
      * Payload is a css mouse pointer style.
91334d
      */
91334d
-    LOK_CALLBACK_MOUSE_POINTER,
91334d
+    LOK_CALLBACK_MOUSE_POINTER = 18,
91334d
 
91334d
     /**
91334d
      * The text content of the formula bar in Calc.
91334d
      */
91334d
-    LOK_CALLBACK_CELL_FORMULA,
91334d
+    LOK_CALLBACK_CELL_FORMULA = 19,
91334d
 
91334d
     /**
91334d
      * Loading a document requires a password.
91334d
@@ -274,7 +274,7 @@ typedef enum
91334d
      * lok::Office::setDocumentPassword().  The document cannot be loaded
91334d
      * without the password.
91334d
      */
91334d
-    LOK_CALLBACK_DOCUMENT_PASSWORD,
91334d
+    LOK_CALLBACK_DOCUMENT_PASSWORD = 20,
91334d
 
91334d
     /**
91334d
      * Editing a document requires a password.
91334d
@@ -282,7 +282,7 @@ typedef enum
91334d
      * Loading the document is blocked until the password is provided via
91334d
      * lok::Office::setDocumentPassword().
91334d
      */
91334d
-    LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY,
91334d
+    LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY = 21,
91334d
 
91334d
     /**
91334d
      * An error happened.
91334d
@@ -296,7 +296,7 @@ typedef enum
91334d
      *     "message": freeform description
91334d
      * }
91334d
      */
91334d
-    LOK_CALLBACK_ERROR,
91334d
+    LOK_CALLBACK_ERROR = 22,
91334d
 
91334d
     /**
91334d
      * Context menu structure
91334d
@@ -318,7 +318,7 @@ typedef enum
91334d
      *
91334d
      *     {"text": "label text3", "type": "command", "command": ".uno:Something3", "checktype": "checkmark|radio|auto", "checked": "true|false"}
91334d
      */
91334d
-    LOK_CALLBACK_CONTEXT_MENU,
91334d
+    LOK_CALLBACK_CONTEXT_MENU = 23,
91334d
 
91334d
     /**
91334d
      * The size and/or the position of the view cursor changed. A view cursor
91334d
@@ -334,7 +334,7 @@ typedef enum
91334d
      * - viewId is a value returned earlier by lok::Document::createView()
91334d
      * - rectangle uses the format of LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR
91334d
      */
91334d
-    LOK_CALLBACK_INVALIDATE_VIEW_CURSOR,
91334d
+    LOK_CALLBACK_INVALIDATE_VIEW_CURSOR = 24,
91334d
 
91334d
     /**
91334d
      * The text selection in one of the other views has changed.
91334d
@@ -349,7 +349,7 @@ typedef enum
91334d
      * - viewId is a value returned earlier by lok::Document::createView()
91334d
      * - selection uses the format of LOK_CALLBACK_TEXT_SELECTION.
91334d
      */
91334d
-    LOK_CALLBACK_TEXT_VIEW_SELECTION,
91334d
+    LOK_CALLBACK_TEXT_VIEW_SELECTION = 25,
91334d
 
91334d
     /**
91334d
      * The cell cursor in one of the other views has changed.
91334d
@@ -364,7 +364,7 @@ typedef enum
91334d
      * - viewId is a value returned earlier by lok::Document::createView()
91334d
      * - rectangle uses the format of LOK_CALLBACK_CELL_CURSOR.
91334d
      */
91334d
-    LOK_CALLBACK_CELL_VIEW_CURSOR,
91334d
+    LOK_CALLBACK_CELL_VIEW_CURSOR = 26,
91334d
 
91334d
     /**
91334d
      * The size and/or the position of a graphic selection in one of the other
91334d
@@ -380,7 +380,7 @@ typedef enum
91334d
      * - viewId is a value returned earlier by lok::Document::createView()
91334d
      * - selection uses the format of LOK_CALLBACK_INVALIDATE_TILES.
91334d
      */
91334d
-    LOK_CALLBACK_GRAPHIC_VIEW_SELECTION,
91334d
+    LOK_CALLBACK_GRAPHIC_VIEW_SELECTION = 27,
91334d
 
91334d
     /**
91334d
      * The blinking text cursor in one of the other views is now visible or
91334d
@@ -396,7 +396,7 @@ typedef enum
91334d
      * - viewId is a value returned earlier by lok::Document::createView()
91334d
      * - visible uses the format of LOK_CALLBACK_CURSOR_VISIBLE.
91334d
      */
91334d
-    LOK_CALLBACK_VIEW_CURSOR_VISIBLE,
91334d
+    LOK_CALLBACK_VIEW_CURSOR_VISIBLE = 28,
91334d
 
91334d
     /**
91334d
      * The size and/or the position of a lock rectangle in one of the other
91334d
@@ -412,7 +412,7 @@ typedef enum
91334d
      * - viewId is a value returned earlier by lok::Document::createView()
91334d
      * - rectangle uses the format of LOK_CALLBACK_INVALIDATE_TILES.
91334d
      */
91334d
-    LOK_CALLBACK_VIEW_LOCK,
91334d
+    LOK_CALLBACK_VIEW_LOCK = 29,
91334d
 
91334d
     /**
91334d
      * The size of the change tracking table has changed.
91334d
@@ -437,7 +437,7 @@ typedef enum
91334d
      * - 'action' is either 'Add' or 'Remove', depending on if this is an
91334d
      *   insertion into the table or a removal.
91334d
      */
91334d
-    LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED,
91334d
+    LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED = 30,
91334d
 
91334d
     /**
91334d
      * An entry in the change tracking table has been modified.
91334d
@@ -461,7 +461,7 @@ typedef enum
91334d
      *
91334d
      * - 'action' is 'Modify'.
91334d
      */
91334d
-    LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED,
91334d
+    LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED = 31,
91334d
 }
91334d
 LibreOfficeKitCallbackType;
91334d
 
91334d
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
91334d
index 0b48cf8b7373..bbf64bf9ec9a 100644
91334d
--- a/libreofficekit/source/gtk/lokdocview.cxx
91334d
+++ b/libreofficekit/source/gtk/lokdocview.cxx
91334d
@@ -77,9 +77,9 @@ struct ViewRectangles
91334d
 /// Private struct used by this GObject type
91334d
 struct LOKDocViewPrivateImpl
91334d
 {
91334d
-    const gchar* m_aLOPath;
91334d
-    const gchar* m_pUserProfileURL;
91334d
-    const gchar* m_aDocPath;
91334d
+    std::string m_aLOPath;
91334d
+    std::string m_aUserProfileURL;
91334d
+    std::string m_aDocPath;
91334d
     std::string m_aRenderingArguments;
91334d
     gdouble m_nLoadProgress;
91334d
     gboolean m_bIsLoading;
91334d
@@ -195,10 +195,7 @@ struct LOKDocViewPrivateImpl
91334d
     std::map<int, ViewRectangle> m_aViewLockRectangles;
91334d
 
91334d
     LOKDocViewPrivateImpl()
91334d
-        : m_aLOPath(nullptr),
91334d
-        m_pUserProfileURL(nullptr),
91334d
-        m_aDocPath(nullptr),
91334d
-        m_nLoadProgress(0),
91334d
+        : m_nLoadProgress(0),
91334d
         m_bIsLoading(false),
91334d
         m_bCanZoomIn(true),
91334d
         m_bCanZoomOut(true),
91334d
@@ -1736,7 +1733,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
91334d
     if (priv->m_bEdit && priv->m_bCursorVisible && !isEmptyRectangle(priv->m_aVisibleCursor) && priv->m_aTextSelectionRectangles.empty())
91334d
     {
91334d
         // Have a cursor, but no selection: we need the middle handle.
91334d
-        gchar* handleMiddlePath = g_strconcat (priv->m_aLOPath, CURSOR_HANDLE_DIR, "handle_image_middle.png", nullptr);
91334d
+        gchar* handleMiddlePath = g_strconcat (priv->m_aLOPath.c_str(), CURSOR_HANDLE_DIR, "handle_image_middle.png", nullptr);
91334d
         if (!priv->m_pHandleMiddle)
91334d
         {
91334d
             priv->m_pHandleMiddle = cairo_image_surface_create_from_png(handleMiddlePath);
91334d
@@ -1764,7 +1761,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
91334d
         if (!isEmptyRectangle(priv->m_aTextSelectionStart))
91334d
         {
91334d
             // Have a start position: we need a start handle.
91334d
-            gchar* handleStartPath = g_strconcat (priv->m_aLOPath, CURSOR_HANDLE_DIR, "handle_image_start.png", nullptr);
91334d
+            gchar* handleStartPath = g_strconcat (priv->m_aLOPath.c_str(), CURSOR_HANDLE_DIR, "handle_image_start.png", nullptr);
91334d
             if (!priv->m_pHandleStart)
91334d
             {
91334d
                 priv->m_pHandleStart = cairo_image_surface_create_from_png(handleStartPath);
91334d
@@ -1776,7 +1773,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
91334d
         if (!isEmptyRectangle(priv->m_aTextSelectionEnd))
91334d
         {
91334d
             // Have a start position: we need an end handle.
91334d
-            gchar* handleEndPath = g_strconcat (priv->m_aLOPath, CURSOR_HANDLE_DIR, "handle_image_end.png", nullptr);
91334d
+            gchar* handleEndPath = g_strconcat (priv->m_aLOPath.c_str(), CURSOR_HANDLE_DIR, "handle_image_end.png", nullptr);
91334d
             if (!priv->m_pHandleEnd)
91334d
             {
91334d
                 priv->m_pHandleEnd = cairo_image_surface_create_from_png(handleEndPath);
91334d
@@ -2207,8 +2204,7 @@ openDocumentInThread (gpointer data)
91334d
     }
91334d
 
91334d
     priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView);
91334d
-    priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath );
91334d
-    priv->m_eDocumentType = static_cast<LibreOfficeKitDocumentType>(priv->m_pDocument->pClass->getDocumentType(priv->m_pDocument));
91334d
+    priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath.c_str() );
91334d
     if ( !priv->m_pDocument )
91334d
     {
91334d
         char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
91334d
@@ -2216,6 +2212,7 @@ openDocumentInThread (gpointer data)
91334d
     }
91334d
     else
91334d
     {
91334d
+        priv->m_eDocumentType = static_cast<LibreOfficeKitDocumentType>(priv->m_pDocument->pClass->getDocumentType(priv->m_pDocument));
91334d
         gdk_threads_add_idle(postDocumentLoad, pDocView);
91334d
         g_task_return_boolean (task, true);
91334d
     }
91334d
@@ -2469,16 +2466,17 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal
91334d
     switch (propId)
91334d
     {
91334d
     case PROP_LO_PATH:
91334d
-        priv->m_aLOPath = g_value_dup_string (value);
91334d
+        priv->m_aLOPath = g_value_get_string (value);
91334d
         break;
91334d
     case PROP_LO_POINTER:
91334d
         priv->m_pOffice = static_cast<LibreOfficeKit*>(g_value_get_pointer(value));
91334d
         break;
91334d
     case PROP_USER_PROFILE_URL:
91334d
-        priv->m_pUserProfileURL = g_value_dup_string(value);
91334d
+        if (const gchar* pUserProfile = g_value_get_string(value))
91334d
+            priv->m_aUserProfileURL = pUserProfile;
91334d
         break;
91334d
     case PROP_DOC_PATH:
91334d
-        priv->m_aDocPath = g_value_dup_string (value);
91334d
+        priv->m_aDocPath = g_value_get_string (value);
91334d
         break;
91334d
     case PROP_DOC_POINTER:
91334d
         priv->m_pDocument = static_cast<LibreOfficeKitDocument*>(g_value_get_pointer(value));
91334d
@@ -2523,16 +2521,16 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
91334d
     switch (propId)
91334d
     {
91334d
     case PROP_LO_PATH:
91334d
-        g_value_set_string (value, priv->m_aLOPath);
91334d
+        g_value_set_string (value, priv->m_aLOPath.c_str());
91334d
         break;
91334d
     case PROP_LO_POINTER:
91334d
         g_value_set_pointer(value, priv->m_pOffice);
91334d
         break;
91334d
     case PROP_USER_PROFILE_URL:
91334d
-        g_value_set_string(value, priv->m_pUserProfileURL);
91334d
+        g_value_set_string(value, priv->m_aUserProfileURL.c_str());
91334d
         break;
91334d
     case PROP_DOC_PATH:
91334d
-        g_value_set_string (value, priv->m_aDocPath);
91334d
+        g_value_set_string (value, priv->m_aDocPath.c_str());
91334d
         break;
91334d
     case PROP_DOC_POINTER:
91334d
         g_value_set_pointer(value, priv->m_pDocument);
91334d
@@ -2632,14 +2630,14 @@ static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* /
91334d
     if (priv->m_pOffice != nullptr)
91334d
         return TRUE;
91334d
 
91334d
-    priv->m_pOffice = lok_init_2(priv->m_aLOPath, priv->m_pUserProfileURL);
91334d
+    priv->m_pOffice = lok_init_2(priv->m_aLOPath.c_str(), priv->m_aUserProfileURL.empty() ? nullptr : priv->m_aUserProfileURL.c_str());
91334d
 
91334d
     if (priv->m_pOffice == nullptr)
91334d
     {
91334d
         g_set_error (error,
91334d
                      g_quark_from_static_string ("LOK initialization error"), 0,
91334d
                      "Failed to get LibreOfficeKit context. Make sure path (%s) is correct",
91334d
-                     priv->m_aLOPath);
91334d
+                     priv->m_aLOPath.c_str());
91334d
         return FALSE;
91334d
     }
91334d
     priv->m_nLOKFeatures |= LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK;
91334d
@@ -3118,8 +3116,8 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOK
91334d
 {
91334d
     LOKDocViewPrivate& pOldPriv = getPrivate(pOldLOKDocView);
91334d
     GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/nullptr, /*error=*/nullptr,
91334d
-                                                       "lopath", pOldPriv->m_aLOPath,
91334d
-                                                       "userprofileurl", pOldPriv->m_pUserProfileURL,
91334d
+                                                       "lopath", pOldPriv->m_aLOPath.c_str(),
91334d
+                                                       "userprofileurl", pOldPriv->m_aUserProfileURL.c_str(),
91334d
                                                        "lopointer", pOldPriv->m_pOffice,
91334d
                                                        "docpointer", pOldPriv->m_pDocument,
91334d
                                                        "halign", GTK_ALIGN_CENTER,
91334d
@@ -3165,7 +3163,7 @@ lok_doc_view_open_document (LOKDocView* pDocView,
91334d
     LOEvent* pLOEvent = new LOEvent(LOK_LOAD_DOC);
91334d
     pLOEvent->m_pPath = pPath;
91334d
 
91334d
-    priv->m_aDocPath = pPath;
91334d
+    g_object_set(G_OBJECT(pDocView), "docpath", pPath, nullptr);
91334d
     if (pRenderingArguments)
91334d
         priv->m_aRenderingArguments = pRenderingArguments;
91334d
     g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
91334d
-- 
91334d
2.14.3
91334d