Fix Windows crash caused by calling js_free (which calls free from the wrong CRT).

Fix some warnings.

This was SVN commit r8873.
This commit is contained in:
Ykkrosh 2011-01-29 17:50:42 +00:00
parent 03c75100ab
commit 6af877a1cb
2 changed files with 6 additions and 4 deletions

View File

@ -621,9 +621,9 @@ bool ScriptInterface::FreezeObject(jsval obj, bool deep)
return false;
if (deep)
return JS_DeepFreezeObject(m->m_cx, JSVAL_TO_OBJECT(obj));
return JS_DeepFreezeObject(m->m_cx, JSVAL_TO_OBJECT(obj)) ? true : false;
else
return JS_FreezeObject(m->m_cx, JSVAL_TO_OBJECT(obj));
return JS_FreezeObject(m->m_cx, JSVAL_TO_OBJECT(obj)) ? true : false;
}
bool ScriptInterface::LoadScript(const std::wstring& filename, const std::wstring& code)
@ -959,14 +959,14 @@ jsval ScriptInterface::CloneValueFromOtherContext(ScriptInterface& otherContext,
}
ScriptInterface::StructuredClone::StructuredClone() :
m_Data(NULL), m_Size(0)
m_Context(NULL), m_Data(NULL), m_Size(0)
{
}
ScriptInterface::StructuredClone::~StructuredClone()
{
if (m_Data)
js_free(m_Data);
JS_free(m_Context, m_Data);
}
shared_ptr<ScriptInterface::StructuredClone> ScriptInterface::WriteStructuredClone(jsval v)
@ -979,6 +979,7 @@ shared_ptr<ScriptInterface::StructuredClone> ScriptInterface::WriteStructuredClo
// Currently we'll probably continue and then crash in ReadStructuredClone
shared_ptr<StructuredClone> ret (new StructuredClone);
ret->m_Context = m->m_cx;
ret->m_Data = data;
ret->m_Size = nbytes;
return ret;

View File

@ -284,6 +284,7 @@ public:
public:
StructuredClone();
~StructuredClone();
JSContext* m_Context;
uint64* m_Data;
size_t m_Size;
};