Re: Exception using browser-pane on Windows
> 2013/08/28 Jeffrey Massung <massung@...>
>
> Just to get it out of the way, this is Windows 7, personal edition of LW
> (6.1.1). I have an OS X application (using LW Pro 6.1.1) that's going pretty
> well at this point and I'm testing on Windows to consider compiling for both
> platforms. I've distilled the code down to the following quick example from
> loading a fresh image:
>
> CL-USER > (hcl:create-temp-file :file-type "html")
> #P"C:/Users/JEFF~1.MAS/AppData/Local/Temp/lwtemp_VOLI31236_1020442Yc9Bxx.html"
An Internet Explorer control is an STA (single-thread apartment) COM object,
meaning that it should be handled in the same thread it was created.
By default, capi:contain creates a new Lisp process (OS thread). When the
browser-pane is first displayed, its interface is created and is bound to
this process (OS thread).
> CL-USER > (capi:contain (make-instance 'capi:browser-pane :url (namestring *)))
> #<CAPI:BROWSER-PANE 22169EA3>
>
> CL-USER > (capi:browser-pane-refresh *)
> Error: Exception C0000005 [flags 0] at 77C422B2
> eax 38 ebx 7226B8 ecx 27 edx 12
> esp 6C222E8 ebp 6C222FC esi 38 edi 34
> 1 (abort) Return to level 0.
> 2 Return to top loop level 0.
>
> The above works on Mac just fine. In my actual application I'm getting loads
> of issues with the browser-pane (again, only on Windows) dealing with
> :browser-navigate-callback when I want to return nil and refreshing.
I don't know the specifics of capi:browser-pane-refresh (& co.), but I'm
almost sure they must be called within the process (OS thread) of the
capi:browser-pane's interface:
(capi:apply-in-pane-process-if-alive * 'capi:browser-pane-refresh *)
> I'm just curious if this is a known issue. I can't believe I'm doing
> something wrong since it works on Mac. Is this a problem with the personal
> edition, but it works with the professional version? Anyone mind testing it?
In Cocoa, the whole GUI must run in the main thread. In Windows, this
doesn't have to be the case.
LispWorks for Mac OS X follows the Cocoa design, but in other platforms it
allows and defaults to contain interfaces/panes running in multiple threads.
You can, however, make the contained browser-pane run in the current process
in Windows, by specifying :process nil to capi:contain. In this case, you
can call capi:browser-refresh directly, but since that's what
capi:apply-in-pane-process-if-alive would do, I suggest you use it in your
final code.
Best regards,
Paulo Madeira
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html