[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 5 commits - cppcanvas/source desktop/unx sfx2/source unotest/source
Michael Meeks
michael at kemper.freedesktop.org
Tue Apr 17 09:14:18 PDT 2012
cppcanvas/source/inc/implrenderer.hxx | 2
cppcanvas/source/mtfrenderer/emfplus.cxx | 6 -
desktop/unx/source/start.c | 16 ++++
sfx2/source/doc/QuerySaveDocument.cxx | 5 +
unotest/source/java/org/openoffice/test/OfficeConnection.java | 34 +++++++---
5 files changed, 49 insertions(+), 14 deletions(-)
New commits:
commit cb0ff30ecf37230f4dc3809d5017dce8ac910aa2
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Apr 14 18:11:11 2012 +0200
OfficeConnection: kill soffice process when Java bridge is disposed
In the rare case that the soffice process outlives the Java side UNO
bridge, ensure that soffice.bin doesn't continue running.
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/unotest/source/java/org/openoffice/test/OfficeConnection.java b/unotest/source/java/org/openoffice/test/OfficeConnection.java
index 3f25443..e08bdc4 100644
--- a/unotest/source/java/org/openoffice/test/OfficeConnection.java
+++ b/unotest/source/java/org/openoffice/test/OfficeConnection.java
@@ -116,24 +116,33 @@ public final class OfficeConnection {
boolean desktopTerminated = true;
if (process != null) {
if (context != null) {
- XMultiComponentFactory factory = context.getServiceManager();
- assertNotNull(factory);
- XDesktop desktop = UnoRuntime.queryInterface(
- XDesktop.class,
- factory.createInstanceWithContext(
- "com.sun.star.frame.Desktop", context));
- context = null;
+ XDesktop desktop = null;
try {
- desktopTerminated = desktop.terminate();
- if (!desktopTerminated) {
- // in case terminate() fails we would wait forever
- // for the process to die, so kill it
- process.destroy();
- }
- assertTrue(desktopTerminated);
- } catch (DisposedException e) {}
+ XMultiComponentFactory factory =
+ context.getServiceManager();
+ assertNotNull(factory);
+ desktop = UnoRuntime.queryInterface(XDesktop.class,
+ factory.createInstanceWithContext(
+ "com.sun.star.frame.Desktop", context));
+ } catch (DisposedException e) {
+ // it can happen that the Java bridge was disposed
+ // already, we want to ensure soffice.bin is killed
+ process.destroy();
+ }
+ context = null;
+ if (desktop != null) {
+ try {
+ desktopTerminated = desktop.terminate();
+ if (!desktopTerminated) {
+ // in case terminate() fails we would wait
+ // forever for the process to die, so kill it
+ process.destroy();
+ }
+ assertTrue(desktopTerminated);
+ } catch (DisposedException e) {}
// it appears that DisposedExceptions can already happen
// while receiving the response of the terminate call
+ }
desktop = null;
} else {
process.destroy();
commit e89231bf31554e123dec1569a120be5cc24b6b8d
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Mar 2 13:49:19 2012 +0100
OfficeConnection.java: don't wait forever if terminate() fails
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/unotest/source/java/org/openoffice/test/OfficeConnection.java b/unotest/source/java/org/openoffice/test/OfficeConnection.java
index ae2cae0..3f25443 100644
--- a/unotest/source/java/org/openoffice/test/OfficeConnection.java
+++ b/unotest/source/java/org/openoffice/test/OfficeConnection.java
@@ -125,6 +125,12 @@ public final class OfficeConnection {
context = null;
try {
desktopTerminated = desktop.terminate();
+ if (!desktopTerminated) {
+ // in case terminate() fails we would wait forever
+ // for the process to die, so kill it
+ process.destroy();
+ }
+ assertTrue(desktopTerminated);
} catch (DisposedException e) {}
// it appears that DisposedExceptions can already happen
// while receiving the response of the terminate call
@@ -139,7 +145,6 @@ public final class OfficeConnection {
}
boolean outTerminated = outForward == null || outForward.terminated();
boolean errTerminated = errForward == null || errForward.terminated();
- assertTrue(desktopTerminated);
assertEquals(0, code);
assertTrue(outTerminated);
assertTrue(errTerminated);
commit fa15135c278e7f371c7bc22bc85e53198b521ca9
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Apr 14 18:17:00 2012 +0200
oosplash: handle SIGTERM by killing soffice.bin
Conflicts:
desktop/unx/source/start.c
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index 6152e4c..6d1decc 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -786,6 +786,19 @@ exec_javaldx (Args *args)
osl_closeFile(fileOut);
}
+// has to be a global :(
+oslProcess * g_pProcess = 0;
+
+void sigterm_handler(int ignored)
+{
+ (void) ignored;
+ if (g_pProcess)
+ {
+ // forward signal to soffice.bin
+ osl_terminateProcess(g_pProcess);
+ }
+}
+
SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
{
int fd = 0;
@@ -798,6 +811,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
/* turn SIGPIPE into an error */
signal( SIGPIPE, SIG_IGN );
+ signal( SIGTERM, &sigterm_handler );
args = args_parse ();
args->pAppPath = get_app_path( argv[0] );
@@ -870,6 +884,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
/* Periodically update the splash & the percent according
to what status_fd says, poll quickly only while starting */
info = child_spawn (args, bAllArgs, bShortWait);
+ g_pProcess = info->child;
while (!child_exited_wait (info, bShortWait))
{
ProgressStatus eResult;
@@ -895,6 +910,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
#endif
status = child_get_exit_code(info);
+ g_pProcess = 0; // reset
switch (status) {
case 79: // re-start with just -env: parameters
#if OSL_DEBUG_LEVEL > 0
commit 67b4c0b556c2bc586d0a2d63d0fd6efa32a6c25c
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Mar 2 14:53:33 2012 +0100
ExecuteQuerySaveDocument: return NO when headless instead of CANCEL
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx
index ff670d6..7ac2b67 100644
--- a/sfx2/source/doc/QuerySaveDocument.cxx
+++ b/sfx2/source/doc/QuerySaveDocument.cxx
@@ -33,9 +33,14 @@
#include <sfx2/sfxuno.hxx>
#include "doc.hrc"
#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
// -----------------------------------------------------------------------------
short ExecuteQuerySaveDocument(Window* _pParent,const String& _rTitle)
{
+ if (Application::IsHeadlessModeEnabled())
+ { // don't block Desktop::terminate() if there's no user to ask
+ return RET_NO;
+ }
String aText( SfxResId( STR_QUERY_SAVE_DOCUMENT ) );
aText.SearchAndReplace( DEFINE_CONST_UNICODE( "$(DOC)" ),
_rTitle );
commit 9e215ad344f0f1df681617072ad5af093eb6944a
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Mar 9 15:35:36 2012 +0100
cppcanvas: processEMFPlus: fix valgrind warning:
When reading EmfPlusRecordTypeDrawImagePoints, handle the variant where
points are stored as 16-bit integers instead of floats correctly.
Found via valgrind on loading bugdoc from fdo#42252.
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index 3c1ec6d..c2d9406 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -208,7 +208,7 @@ static float GetSwapFloat( SvStream& rSt )
/* EMF+ */
void ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, sal_uInt32 flags = 0);
- void ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags = 0);
+ void ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags);
void MapToDevice (double &x, double &y);
::basegfx::B2DPoint Map (::basegfx::B2DPoint& p);
::basegfx::B2DPoint Map (double ix, double iy);
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 91c9560..a6253c5 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1428,9 +1428,9 @@ namespace cppcanvas
if (unknown == 3) { // it probably means number of points defining destination rectangle
float x1, y1, x2, y2, x3, y3;
- ReadPoint (rMF, x1, y1);
- ReadPoint (rMF, x2, y2);
- ReadPoint (rMF, x3, y3);
+ ReadPoint (rMF, x1, y1, flags);
+ ReadPoint (rMF, x2, y2, flags);
+ ReadPoint (rMF, x3, y3, flags);
BitmapEx aBmp( image.graphic.GetBitmapEx () );
const Rectangle aCropRect (::vcl::unotools::pointFromB2DPoint (Map (sx, sy)),
More information about the Libreoffice-commits
mailing list