summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-04-07 13:10:01 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-04-07 14:46:03 +0200
commit43b8ee70fcedfb1a2c3ef996cea4842e06e020b0 (patch)
tree2869399399a370ac083b675d58e8b2772b14d5cd
parentf1c7aa5267a8045892890954df3c269a3abaab99 (diff)
reap the glxtest child even if OpenGL is not used
E.g. with Skia enabled (thus blocking OpenGL) the zombie stays around. Change-Id: I9769ec804e4727189bbfe58d415e8ad3a6b234ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91811 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--desktop/source/app/app.cxx5
-rw-r--r--desktop/source/app/sofficemain.cxx9
-rw-r--r--include/vcl/glxtestprocess.hxx18
-rw-r--r--vcl/Library_vcl.mk8
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx18
-rw-r--r--vcl/source/salmain/salmain.cxx2
6 files changed, 45 insertions, 15 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index c00885433eac..2fb7b048231f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1558,13 +1558,10 @@ int Desktop::Main()
#endif
// In headless mode, reap the process started by fire_glxtest_process() early in soffice_main
- // (desktop/source/app/sofficemain.cxx), in a code block that needs to be covered by the same
- // #if condition as this code block:
-#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI && HAVE_FEATURE_OPENGL
+ // (desktop/source/app/sofficemain.cxx).
if (rCmdLineArgs.IsHeadless()) {
reap_glxtest_process();
}
-#endif
// Release solar mutex just before we wait for our client to connect
{
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index 90e322260c1e..d95356fd255d 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -59,17 +59,8 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
CrashReporter::installExceptionHandler();
#endif
-#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI && HAVE_FEATURE_OPENGL
- /* Run test for OpenGL support in own process to avoid crash with broken
- * OpenGL drivers. Start process as early as possible.
- * In non-headless mode, the process will be reaped in X11OpenGLDeviceInfo::GetData
- * (vcl/opengl/x11/X11DeviceInfo.cxx). In headless mode, the process will be reaped late in
- * Desktop::Main (desktop/source/app/app.cxx), in a code block that needs to be covered by the
- * same #if condition as this code block.
- */
bool bSuccess = fire_glxtest_process();
SAL_WARN_IF(!bSuccess, "desktop.opengl", "problems with glxtest");
-#endif
#if defined ANDROID
try {
diff --git a/include/vcl/glxtestprocess.hxx b/include/vcl/glxtestprocess.hxx
index b13312ebda64..848135442867 100644
--- a/include/vcl/glxtestprocess.hxx
+++ b/include/vcl/glxtestprocess.hxx
@@ -10,11 +10,29 @@
#ifndef INCLUDED_INCLUDE_VCL_GLXTESTPROCESS_HXX
#include <sal/config.h>
+#include <config_features.h>
+
+#if defined(UNX) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI \
+ && HAVE_FEATURE_OPENGL
+/* Run test for OpenGL support in own process to avoid crash with broken
+ * OpenGL drivers. Start process as early as possible.
+ * In non-headless mode, the process will be reaped in X11OpenGLDeviceInfo::GetData
+ * (vcl/opengl/x11/X11DeviceInfo.cxx). In headless mode, the process will be reaped late in
+ * Desktop::Main (desktop/source/app/app.cxx).
+ */
bool fire_glxtest_process();
void reap_glxtest_process();
+#else
+
+inline bool fire_glxtest_process() { return true; }
+
+inline void reap_glxtest_process() {}
+
+#endif
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 39d99957883e..25b2e7f66be1 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -724,4 +724,12 @@ $(eval $(call gb_Library_add_nativeres,vcl,vcl/salsrc))
$(eval $(call gb_Library_use_package,vcl,postprocess_images))
endif
+ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
+ifeq ($(USING_X11),TRUE)
+$(eval $(call gb_Library_use_static_libraries,vcl,\
+ glxtest \
+))
+endif
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 60f023b7dc4c..1ea130942ba0 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -35,6 +35,7 @@
#include <bitmapwriteaccess.hxx>
#include <watchdog.hxx>
#include <vcl/skia/SkiaHelper.hxx>
+#include <vcl/glxtestprocess.hxx>
#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID && !defined HAIKU
#include <opengl/x11/X11DeviceInfo.hxx>
@@ -903,11 +904,26 @@ PreDefaultWinNoOpenGLZone::~PreDefaultWinNoOpenGLZone()
bTempOpenGLDisabled = false;
}
+static void reapGlxTest()
+{
+ // Reap the glxtest child, or it'll stay around as a zombie,
+ // as X11OpenGLDeviceInfo::GetData() will not get called.
+ static bool bTestReaped = false;
+ if(!bTestReaped)
+ {
+ reap_glxtest_process();
+ bTestReaped = true;
+ }
+}
+
bool OpenGLHelper::isVCLOpenGLEnabled()
{
// Skia always takes precedence if enabled
if( SkiaHelper::isVCLSkiaEnabled())
+ {
+ reapGlxTest();
return false;
+ }
/**
* The !bSet part should only be called once! Changing the results in the same
@@ -965,6 +981,8 @@ bool OpenGLHelper::isVCLOpenGLEnabled()
if (bRet)
WatchdogThread::start();
+ else
+ reapGlxTest();
CrashReporter::addKeyValue("UseOpenGL", OUString::boolean(bRet), CrashReporter::Write);
diff --git a/vcl/source/salmain/salmain.cxx b/vcl/source/salmain/salmain.cxx
index d0771d236824..d03f6b2cd28b 100644
--- a/vcl/source/salmain/salmain.cxx
+++ b/vcl/source/salmain/salmain.cxx
@@ -27,9 +27,7 @@
#include <vcl/svmain.hxx>
SAL_IMPLEMENT_MAIN() {
-#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI && !defined HAIKU
fire_glxtest_process();
-#endif
tools::extendApplicationEnvironment();
vclmain::createApplication();
return SVMain();