[Libreoffice-commits] core.git: sc/source
Michael Meeks
michael.meeks at collabora.com
Thu Nov 28 16:01:26 PST 2013
sc/source/core/opencl/opencl_device.cxx | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
New commits:
commit 68b2573a60d145e81cdef7748e4107c84bfa1b47
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Nov 28 23:59:50 2013 +0000
GPU Calc: Avoid dereferencing null 'score' field in some cases.
Change-Id: I2e76d19986326b15c088e6dcce1da3be3924d0fc
diff --git a/sc/source/core/opencl/opencl_device.cxx b/sc/source/core/opencl/opencl_device.cxx
index a3fa004..80062c6 100644
--- a/sc/source/core/opencl/opencl_device.cxx
+++ b/sc/source/core/opencl/opencl_device.cxx
@@ -391,19 +391,26 @@ ds_status pickBestDevice(ds_profile* profile, int* bestDeviceIdx)
for (unsigned int d = 0; d < profile->numDevices; d++)
{
- ds_device device = profile->devices[d];
- LibreOfficeDeviceScore score = *(LibreOfficeDeviceScore*)device.score;
+ ds_device device = profile->devices[d];
+ LibreOfficeDeviceScore *pScore = (LibreOfficeDeviceScore*)device.score;
+
+ float fScore = -1;
+ if (pScore)
+ fScore = pScore->fTime;
+ else
+ LOG_PRINTF("Unusual null score");
+
if (DS_DEVICE_OPENCL_DEVICE == device.type)
{
- LOG_PRINTF("[DS] Device[" << d << "] " << device.oclDeviceName << " (OpenCL) score is " << score.fTime);
+ LOG_PRINTF("[DS] Device[" << d << "] " << device.oclDeviceName << " (OpenCL) score is " << fScore);
}
else
{
- LOG_PRINTF("[DS] Device[" << d << "] CPU (Native) score is " << score.fTime);
+ LOG_PRINTF("[DS] Device[" << d << "] CPU (Native) score is " << fScore);
}
- if (score.fTime < bestScore)
+ if (fScore < bestScore)
{
- bestScore = score.fTime;
+ bestScore = fScore;
*bestDeviceIdx = d;
}
}
More information about the Libreoffice-commits
mailing list