summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-17 16:38:04 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-17 16:00:44 +0000
commit45c2410041c48c22bd860efb42d4daadad7869b0 (patch)
tree7adf4d278976bcadd284c8d1cbd6a863f98c14d0 /libreofficekit
parent9ec54e92407cd632c4e38317f914edd557835a86 (diff)
LOK: change type of view ids to uintptr_t
This fixes the following problem: - createView() = 1 - createView() = 2 - destroyView(1) and then view #2 was renumbered to 1. Instead expose the pointer address of the SfxViewShell as the ID, which is not changing in such a situation. Note that the SfxViewShell <-> ID mapping is an implementation detail of SfxLokHelper, and only pointers are converted to IDs, user-supplied IDs are never converted back to pointers. Change-Id: If79ef8b99ba391011b5d82b219ad13447d44cd5a Reviewed-on: https://gerrit.libreoffice.org/26423 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index dc986daf0bd3..6f2b8eaf12a7 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -127,7 +127,7 @@ struct LOKDocViewPrivateImpl
///@}
/// View ID, returned by createView() or 0 by default.
- int m_nViewId;
+ std::uintptr_t m_nViewId;
/**
* Contains a freshly set zoom level: logic size of a tile.
@@ -837,6 +837,7 @@ static gboolean postDocumentLoad(gpointer pData)
g_info("%s", ss.str().c_str());
priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument, priv->m_aRenderingArguments.c_str());
+ priv->m_nViewId = priv->m_pDocument->pClass->getView(priv->m_pDocument);
priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView);
priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips);
priv->m_nParts = priv->m_pDocument->pClass->getParts(priv->m_pDocument);
@@ -2691,7 +2692,9 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOK
// No documentLoad(), just a createView().
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pNewDocView));
LOKDocViewPrivate& pNewPriv = getPrivate(LOK_DOC_VIEW(pNewDocView));
- pNewPriv->m_nViewId = pDocument->pClass->createView(pDocument);
+ // Store the view id only later in postDocumentLoad(), as
+ // initializeForRendering() changes the id in Impress.
+ pDocument->pClass->createView(pDocument);
pNewPriv->m_aRenderingArguments = pOldPriv->m_aRenderingArguments;
postDocumentLoad(pNewDocView);