Mark,

Your change looks correct.  Yes, at the time I designed that API, I
was assuming that attach might fail, but ended up not really finding
any failure scenarios that would be caught.

I don't have Word, so debugging this using oodialog looks like the
approach we need to use.

Rick

On Sun, Jul 13, 2008 at 4:29 PM, Mark Miesfeld <[EMAIL PROTECTED]> wrote:
> Thought I'd start a new thread on this.
>
> (I did see your post by the way Rick.  Your last commit fixed the crash.)
>
> In IntepreterInstanceStubs.cpp, AttachThread returns a logical:
>
> logical_t RexxEntry AttachThread(RexxInstance *c, RexxThreadContext **tc)
> {
>    InstanceApiContext context(c);
>    return context.instance->attachThread(*tc);
> }
>
> But, IntepreterInstance::attachThread always returns 0:
>
> int InterpreterInstance::attachThread(RexxThreadContext *&attachedContext)
> {
>    RexxActivity *activity = attachThread();
>    attachedContext = activity->getThreadContext();
>    return 0;
> }
>
> So, in InterpreterInstanceStubs.cpp I just committed this change,
> which seems right:
>
> logical_t RexxEntry AttachThread(RexxInstance *c, RexxThreadContext **tc)
> {
>    InstanceApiContext context(c);
>    return (context.instance->attachThread(*tc) == 0);
> }
>
> Not sure if that's what you had in mind Rick.  At the higher level, it
> seems you thought AtttachThread() could fail.  But at the
> InterpreterInstance level it looks like you thought it would always
> succeed.
>
> With that change, I now get some unpredicatable results.
>
> For OleObject, I get a crash with my 'event' testing program.
>
> In ooDialog I changed my quick hack to this:
>
>  printf("Got F1 self=%p interpreter=%p context=%p msg=%s\n",
>        addressedTo->self, interpreter, context, m[i].rexxProgram);
>
>  if ( interpreter->AttachThread(&context) )
>  {
>     printf("DID attach thread. context=%p\n", context);
>     context->SendMessage1(addressedTo->self, m[i].rexxProgram,
> context->NewInteger(phi->iCtrlId));
>     context->DetachThread();     // detach the thread this is just a test.
>  }
>  else
>  {
>     printf("Did NOT attach thread.\n");
>  }
>
> And sometimes I get the SendMethod1 invoking my method and sometimes I don't:
>
> E:\work.ooRexx\3.x\interpreter\Win32Dbg>.\rexx listKey.rex
> self=7F3AEBD0 contex=000AD464 instance=7FC94FC0
> Got back: 0
> Got F1 self=7F3AEBD0 interpreter=7FC94FC0 context=00000000 msg=ONHELP
> DID attach thread. context=7F448CA4
> Got F1 self=7F3AEBD0 interpreter=7FC94FC0 context=00000000 msg=ONHELP
> DID attach thread. context=7F448CA4
> ^C
>
> No invocation of the onHelp method in the ooDialog dialog above.  But
> running it another time I did get an invocation:
>
> E:\work.ooRexx\3.x\interpreter\Win32Dbg>.\rexx listKey.rex
> self=7F3AEBD0 contex=000AD464 instance=7FC94FC0
> Got back: 0
> Connect key press (ALL) ret: 0
> Got F1 self=7F3AEBD0 interpreter=7FC94FC0 context=00000000 msg=ONHELP
> DID attach thread. context=7F462A44
> in onHelp arg count: 1       <----------------
> ^C
> E:\work.ooRexx\3.x\interpreter\Win32Dbg>
>
> I haven't made any progress debugging this.
>
> Rick, I could send you the OleObject program, it needs Word.
>
> Or, I could send you the ooDialog changes and my test program for that
> if you wanted to make a temporary change to ooDialog to take a look at
> it that way.
>
> --
> Mark Miesfeld
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to