desktop/source/lib/init.cxx | 12 ++++++++---- libreofficekit/Module_libreofficekit.mk | 6 +++--- libreofficekit/qa/unit/tiledrendering.cxx | 2 +- libreofficekit/source/gtk/lokdocview.c | 22 ++++++++++++++++++---- 4 files changed, 30 insertions(+), 12 deletions(-)
New commits: commit 51868fb309ceaf9d03949b0e33ad09e70bb72f02 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Mon Jul 28 09:02:25 2014 +0200 DO NOT MERGE: reenable LOK tiled rendering test (BRANCH ONLY). Change-Id: Ica4e570cafa25f4c642016608d8d510e668ed701 diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk index 8523b1a..071ea93 100644 --- a/libreofficekit/Module_libreofficekit.mk +++ b/libreofficekit/Module_libreofficekit.mk @@ -16,9 +16,9 @@ $(eval $(call gb_Module_add_targets,libreofficekit,\ Executable_lokconf_init \ )) -# $(eval $(call gb_Module_add_check_targets,libreofficekit,\ -# CppunitTest_libreofficekit_tiledrendering \ -# )) +$(eval $(call gb_Module_add_check_targets,libreofficekit,\ + CppunitTest_libreofficekit_tiledrendering \ +)) ifneq ($(ENABLE_GTK),) $(eval $(call gb_Module_add_targets,libreofficekit,\ commit a08d6ab6f0cfc00b578e39d7b107857af21d50e6 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Mon Jul 28 16:29:43 2014 +0200 Prevent LOK DocView crash if document too large. There seems to be a maximum size that gdk's pixbuf can handle, however I have been unable to find any documentatation. Seeing as the current implementation isn't realistically useable anyway, we might as well set a hard limit here (in practice we'd have much smaller tiles + compositing). Specifically extras/source/shellnew/soffice.ods will fail without this patch. Change-Id: I6ac495adca8e15878989375ef8b2de472788279a diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index cdc2339..e8fe526 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -108,12 +108,26 @@ void renderDocument( LOKDocView* pDocView ) pDocView->pDocument->pClass->getDocumentSize( pDocView->pDocument, &nWidth, &nHeight ); - // Draw the whole document at once (for now) - // TODO: we really should scale by screen DPI here -- 10 seems to be a vaguely // correct factor for my screen at least. - nRenderWidth = nWidth * pDocView->fZoom / 10; - nRenderHeight = nHeight * pDocView->fZoom / 10; + const float fScaleFactor = 0.1; + + // Various things blow up if we try to draw too large a tile, + // this size seems to be safe. (Very rare/unlikely that + const int nMaxWidth = 100000; + if ( nWidth * fScaleFactor > nMaxWidth ) + { + nWidth = nMaxWidth; + } + if ( nHeight * fScaleFactor > nMaxWidth ) + { + nHeight = nMaxWidth; + } + + // Draw the whole document at once (for now) + + nRenderWidth = nWidth * pDocView->fZoom * fScaleFactor; + nRenderHeight = nHeight * pDocView->fZoom * fScaleFactor; pDocView->pPixBuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE, 8, commit d88283829375fb920cb7f4e8d6b68b3461cd6256 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Mon Jul 28 16:22:47 2014 +0200 Use CPPUNIT_ASSERT instead of assert. Change-Id: I24e7934002ebdde208db74ae3308b26875a3155b diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx index b231eb0..9c035b4 100644 --- a/libreofficekit/qa/unit/tiledrendering.cxx +++ b/libreofficekit/qa/unit/tiledrendering.cxx @@ -77,7 +77,7 @@ void TiledRenderingTest::testOverlay() scoped_ptr< Office > pOffice( lok_cpp_init( sLOPath.c_str() ) ); - assert( pOffice.get() ); + CPPUNIT_ASSERT( pOffice.get() ); scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) ); commit 6ee107e0ab3686977d299b47f5e44bbffde070dc Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Mon Jul 28 16:18:57 2014 +0200 LOK: do clean main thread shutdown cleanly. Change-Id: If44971f67a489f6b50dee6c1683707c47e695de4 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b73e4e2..b17516c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -248,6 +248,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit { OUString maLastExceptionMsg; shared_ptr< LibreOfficeKitClass > m_pOfficeClass; + pthread_t maThread; LibLibreOffice_Impl() { @@ -600,7 +601,7 @@ static void* lo_startmain(void*) static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) { - (void) pThis; + LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); static bool bInitialized = false; if (bInitialized) @@ -668,8 +669,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) // then use it to wait until we're definitely ready to continue. OfficeIPCThread::EnableOfficeIPCThread(); - pthread_t thread; - pthread_create(&thread, 0, lo_startmain, NULL); + pthread_create(&(pLib->maThread), 0, lo_startmain, NULL); OfficeIPCThread::WaitForReady(); // If the Thread has been disabled again that indicates that a @@ -713,8 +713,12 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(const char* install_pat static void lo_destroy(LibreOfficeKit *pThis) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); - delete pLib; gImpl = NULL; + + Application::Quit(); + pthread_join(pLib->maThread, NULL); + + delete pLib; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits