diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-08-20 17:03:30 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-08-21 06:43:48 +0000 |
commit | d20e7e38641868bf14041f090b3668e0148904c7 (patch) | |
tree | 591de5cf0e45281ac1eb02b516ed29f578312012 /vcl/inc/opengl/zone.hxx | |
parent | 5a2d6bf3a94f127307d6a9464033b2226508ff38 (diff) |
tdf#93547 - Disable OpenGL if we have a SEGV on windows in that code.
Annotate when we are in an OpenGL rendering zone.
Check for this in the VCL signal handler, and force OpenGL off here
if exception occurred inside an OpenGL code-path.
Change-Id: I85a4b3d4a374593dc55d01a39ec4c7c3c262c332
Reviewed-on: https://gerrit.libreoffice.org/17881
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/inc/opengl/zone.hxx')
-rw-r--r-- | vcl/inc/opengl/zone.hxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vcl/inc/opengl/zone.hxx b/vcl/inc/opengl/zone.hxx new file mode 100644 index 000000000000..c251c4fa85d8 --- /dev/null +++ b/vcl/inc/opengl/zone.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_GUARD_H +#define INCLUDED_VCL_INC_OPENGL_GUARD_H + +#include <sal/config.h> + +/** + * We want to be able to detect if a given crash came + * from the OpenGL code, so use this helper to track that. + */ +class OpenGLSalGraphicsImpl; +class OpenGLZone { + static int gnInOpenGLZone; + friend class OpenGLSalGraphicsImpl; + static void enter() { gnInOpenGLZone++; } + static void leave() { gnInOpenGLZone--; } +public: + OpenGLZone() { enter(); } + ~OpenGLZone() { leave(); } + static bool isInZone() { return gnInOpenGLZone > 0; } + static void hardDisable(); +}; + +#endif // INCLUDED_VCL_INC_OPENGL_PROGRAM_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |