Index: fpdfsdk/src/javascript/Field.cpp |
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp |
index 66a9601cbf27dca62e31a706c8e11c5d2848b494..140bb422feb52a460fb0a29b987815a4535878f7 100644 |
--- a/fpdfsdk/src/javascript/Field.cpp |
+++ b/fpdfsdk/src/javascript/Field.cpp |
@@ -3300,8 +3300,6 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, |
return FALSE; |
CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
- ASSERT(pFormField != NULL); |
- |
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
return FALSE; |
@@ -3310,17 +3308,13 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, |
return FALSE; |
CJS_Context* pContext = (CJS_Context*)cc; |
- ASSERT(pContext != NULL); |
- |
CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
- ASSERT(pRuntime != NULL); |
- |
v8::Local<v8::Object> pObj = |
FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, |
FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")); |
ASSERT(pObj.IsEmpty() == FALSE); |
- CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pObj); |
+ CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); |
CPDF_Stream* pIconStream = NULL; |
@@ -3339,8 +3333,6 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, |
return TRUE; |
} |
-//#pragma warning(default: 4800) |
- |
FX_BOOL Field::buttonImportIcon(IFXJS_Context* cc, |
const CJS_Parameters& params, |
CJS_Value& vRet, |
@@ -3526,22 +3518,20 @@ FX_BOOL Field::getArray(IFXJS_Context* cc, |
CJS_Array FormFieldArray(m_isolate); |
for (int j = 0, jsz = swSort.GetSize(); j < jsz; j++) { |
- CFX_WideString* pStr = swSort.GetAt(j); |
- |
+ nonstd::unique_ptr<CFX_WideString> pStr(swSort.GetAt(j)); |
Lei Zhang
2015/09/17 00:10:23
I didn't see the delete / RemoveAll() at first and
|
v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( |
pRuntime->GetIsolate(), pContext, |
FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field")); |
ASSERT(pObj.IsEmpty() == FALSE); |
- CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(pObj); |
+ CJS_Field* pJSField = |
+ (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
Field* pField = (Field*)pJSField->GetEmbedObject(); |
pField->AttachField(m_pJSDoc, *pStr); |
CJS_Value FormFieldValue(m_isolate); |
FormFieldValue = pJSField; |
FormFieldArray.SetElement(j, FormFieldValue); |
- |
- delete pStr; |
} |
vRet = FormFieldArray; |