Index: xfa/src/fwl/src/lightwidget/scrollbar.cpp |
diff --git a/xfa/src/fwl/src/lightwidget/scrollbar.cpp b/xfa/src/fwl/src/lightwidget/scrollbar.cpp |
index eaf9b575ef38b6687f75f2c689133f0cf0d06279..a7a177d0ab10d0a544afee9d8841a5388f1008e6 100644 |
--- a/xfa/src/fwl/src/lightwidget/scrollbar.cpp |
+++ b/xfa/src/fwl/src/lightwidget/scrollbar.cpp |
@@ -14,15 +14,15 @@ FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) { |
if (pProperties) { |
*m_pProperties = *pProperties; |
} |
- m_pIface = new IFWL_ScrollBar; |
- FWL_ERR ret = |
- ((IFWL_ScrollBar*)m_pIface) |
- ->Initialize(m_pProperties->MakeWidgetImpProperties(nullptr), |
- nullptr); |
- if (ret == FWL_ERR_Succeeded) { |
- CFWL_Widget::Initialize(); |
+ nonstd::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create( |
+ m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); |
+ FWL_ERR ret = pScrollBar->Initialize(); |
+ if (ret != FWL_ERR_Succeeded) { |
+ return ret; |
} |
- return ret; |
+ m_pIface = pScrollBar.release(); |
+ CFWL_Widget::Initialize(); |
+ return FWL_ERR_Succeeded; |
} |
FX_BOOL CFWL_ScrollBar::IsVertical() { |
if (!m_pIface) |