[Libreoffice-commits] core.git: vcl/source vcl/win
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 16 15:55:37 UTC 2020
vcl/source/app/svapp.cxx | 11 ++++++++++-
vcl/win/app/salinfo.cxx | 10 +++++++++-
2 files changed, 19 insertions(+), 2 deletions(-)
New commits:
commit 3741d70743c297029f54b20b0ca711f40cff7097
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Mar 12 14:12:59 2020 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Mar 16 16:55:01 2020 +0100
Some more checks for correct screen size
Change-Id: Id5a811e4227052fd9117ab2b099de31e8e3b90c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90413
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 1f422e33617a..301b934b4ab9 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1245,7 +1245,16 @@ unsigned int Application::GetDisplayExternalScreen()
tools::Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen )
{
SalSystem* pSys = ImplGetSalSystem();
- return pSys ? pSys->GetDisplayScreenPosSizePixel( nScreen ) : tools::Rectangle();
+ if (!pSys)
+ {
+ SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen << " failed");
+ assert(false);
+ return tools::Rectangle();
+ }
+ tools::Rectangle aRect = pSys->GetDisplayScreenPosSizePixel(nScreen);
+ if (aRect.getHeight() == 0)
+ SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen << " returned 0 height.");
+ return aRect;
}
namespace {
diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index ccb6d3806f95..a19ca597f9c5 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -20,6 +20,7 @@
#include <svsys.h>
#include <o3tl/char16_t2wchar_t.hxx>
+#include <sal/log.hxx>
#include <vcl/window.hxx>
#include <win/salsys.h>
@@ -155,7 +156,14 @@ unsigned int WinSalSystem::GetDisplayBuiltInScreen()
tools::Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen )
{
initMonitors();
- return (nScreen < m_aMonitors.size()) ? m_aMonitors[nScreen].m_aArea : tools::Rectangle();
+ if (nScreen >= m_aMonitors.size())
+ {
+ SAL_WARN("vcl", "Requested screen size/pos for screen #"
+ << nScreen << ", but only " << m_aMonitors.size() << " screens found.");
+ assert(false);
+ return tools::Rectangle();
+ }
+ return m_aMonitors[nScreen].m_aArea;
}
int WinSalSystem::ShowNativeMessageBox(const OUString& rTitle, const OUString& rMessage)
More information about the Libreoffice-commits
mailing list