diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-19 13:53:02 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-19 19:47:44 +0000 |
commit | bc8dcc3ede286fbcaac3f741c379297cffff0eea (patch) | |
tree | 4eb364ea4def674590d8ead928f39247aad70c37 /fpdfsdk/pdfwindow/cpwl_color.h | |
parent | 352b6971deeb8e7438b6880fd4a26fd3f9382c47 (diff) | |
download | pdfium-bc8dcc3ede286fbcaac3f741c379297cffff0eea.tar.xz |
Add ObservedPtrs to PWL_CREATEPARAM
It's possible for both the provider and attached widget to be destroyed before
the PWL_CREATEPARAM objects which point to them. This causes issues when those
widgets access their attached widget or provider.
This CL wraps the pAttachedWidget and pProvider into ObservedPtrs so we will
know if the underlying pointer has gone away.
BUG=chromium:681351
Change-Id: Ib40445be9487dc3e89a66bb7407abdeed7d2c946
Reviewed-on: https://pdfium-review.googlesource.com/2270
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_color.h')
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_color.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_color.h b/fpdfsdk/pdfwindow/cpwl_color.h new file mode 100644 index 0000000000..c1f9e6ea97 --- /dev/null +++ b/fpdfsdk/pdfwindow/cpwl_color.h @@ -0,0 +1,48 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_PDFWINDOW_CPWL_COLOR_H_ +#define FPDFSDK_PDFWINDOW_CPWL_COLOR_H_ + +#include "core/fpdfdoc/cpdf_formcontrol.h" + +struct CPWL_Color { + CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT, + FX_FLOAT color1 = 0.0f, + FX_FLOAT color2 = 0.0f, + FX_FLOAT color3 = 0.0f, + FX_FLOAT color4 = 0.0f) + : nColorType(type), + fColor1(color1), + fColor2(color2), + fColor3(color3), + fColor4(color4) {} + + CPWL_Color(int32_t r, int32_t g, int32_t b) + : nColorType(COLORTYPE_RGB), + fColor1(r / 255.0f), + fColor2(g / 255.0f), + fColor3(b / 255.0f), + fColor4(0) {} + + void ConvertColorType(int32_t other_nColorType); + + void Reset() { + nColorType = COLORTYPE_TRANSPARENT; + fColor1 = 0.0f; + fColor2 = 0.0f; + fColor3 = 0.0f; + fColor4 = 0.0f; + } + + int32_t nColorType; + FX_FLOAT fColor1; + FX_FLOAT fColor2; + FX_FLOAT fColor3; + FX_FLOAT fColor4; +}; + +#endif // FPDFSDK_PDFWINDOW_CPWL_COLOR_H_ |