The specific condition is that RBScript runs in a thread, is interactive and
responds to events.
The code:
void _EventNotify(int uPP, REALobject theObj, int x, int y, int dx, int dy)
{
/* this should report values related to the instance. We need to know
* what instance, so return the pointer address of the instance. We also
* need the provide the pointer adress of this REALproc. If this call is
* related to a scrollbar's (theObj) ValueChanged Event then we just
report it.
* Context.EventType = "Action"
* Context.EventInstance = "object;addressof instance"
* Context.EventPtr = "ptr;"
* Here we need to call void
Process_ReleaseScriptLock(REALcontrolInstance instance)
*/
_RBScriptCallback* data = Delegate_FindUs(theObj);
dddprintf((char*)"_EventNotify, what's up? (data = %x)", data);
if (data != nil) {
if (RBScript_IsThreadSuspended(data->script)) {
dddprintf((char*)"_EventNotify is suspended");
return;
}
XString objectString = "object;";
long ref = (long)theObj;
REALobject obj = REALNewVariantInteger(ref);
REALstring value;
if (REALGetPropValueString(obj, "StringValue", &value))
dddprintf((char*)"got a string from variant, theObj =
%d, obj = %d, str = %s", theObj, obj, value->CString());
else dddprintf((char*)"failure to get a string from variant");
objectString.add(value);
// XVariant xv = (long)theObj;
// XString temp = (REALstring)xv;
// objectString.add(temp);
// xv.unlock();
// temp.unlock();
dddprintf((char*)"ya??");
XString eventName = Del_findCallEvent(data->self, uPP);
dddprintf((char*)"_EventNotify: UPP (%i), objectString (%s),
eventName (%s)", uPP, (const char*)objectString, (const char*)eventName);
// so we know the object (theObj), and we know the NotifyUPP
involved
EventObject_CreateObjectEvent(data->self, kEventObjectType,
kEventObjectID, objectString, eventName, x, y, dx, dy);
Process_ReleaseScriptLock(data->script);
}
}
The crash in Vista occurs when calling REALGetPropValueString and if the
following is called, before REALGetPropValueString:
long num;
if (REALGetPropValueInt32(obj, "IntValue", &num))
dddprintf((char*)"got a IntValue from variant, theObj =
%d, obj = %d, num = %d", theObj, obj, num);
else dddprintf((char*)"failure to get a int from variant");
which by purpose will return false, because the signature should have been
IntegerValue, instead of IntValue, then the call to REALGetPropValueString
works fine. I am at loss here, because a simplified sample project, does not
produce the crash. The big question is, what's the difference between XP and
Vista in this context? OS Threads and dynamic access does not like this?
- Alfred Van Hoek
[email protected]
http://web.mac.com/vanhoek
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>