Fixed wxJS GetKeyState. Fixed crash when manipulating a destroyed button.

This was SVN commit r6935.
This commit is contained in:
Ykkrosh 2009-07-02 11:47:32 +00:00
parent de78e22094
commit cc572d26c7
2 changed files with 7 additions and 1 deletions

View File

@ -88,6 +88,9 @@ bool Button::GetProperty(wxButton *p,
int id,
jsval *vp)
{
if ( p == NULL )
return false;
if ( id == P_LABEL )
*vp = ToJS(cx, p->GetLabel());
@ -100,6 +103,9 @@ bool Button::SetProperty(wxButton *p,
int id,
jsval *vp)
{
if ( p == NULL )
return false;
if ( id == P_LABEL )
{
wxString label;

View File

@ -101,7 +101,7 @@ JSBool wxjs::gui::GetKeyState(JSContext *cx, JSObject *obj, uintN argc, jsval *a
int key;
if (! FromJS(cx, argv[0], key))
return JS_FALSE;
*rval = (wxGetKeyState((wxKeyCode)key) ? JS_TRUE : JS_FALSE);
*rval = (wxGetKeyState((wxKeyCode)key) ? JSVAL_TRUE : JSVAL_FALSE);
return JS_TRUE;
}