Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on calling WebViewObject.SetVisibility(false) on Editor mode #11

Closed
kimsama opened this issue Apr 12, 2013 · 3 comments
Closed

Crash on calling WebViewObject.SetVisibility(false) on Editor mode #11

kimsama opened this issue Apr 12, 2013 · 3 comments

Comments

@kimsama
Copy link

kimsama commented Apr 12, 2013

Hello,

Unity Editor crashes when WebViewObject.SetVisibility(false) is called.

I put a button and call Unity.call('close') in the html then make the webview to be closed when it received 'close' message.

The message is correctly arrived on Unity but it crashes when it calls WebViewObject.SetVisibility(false).:

    // regisiter callback
    webViewObject.Init((msg)=>{
        Debug.Log(string.Format("CallFromJS[{0}]", msg));

        if (msg == "close")
        {
            webViewObject.SetVisibility(false);
        }
    });

The only differences what I've changed is putting code which check the message then change the visibility of the webviewObject.

I ran it on OSX 10.8.2.

I also tried to do clean build the OSX plugin with Xcode 4.6. Building 32bit bundle has no problem, but got bunch of errors with 64bit bundle.

Is there any way to debug OSX bundle when Unity is on play mode?

-Kim

@kimsama
Copy link
Author

kimsama commented Apr 12, 2013

Ok, within Xcode, with Product > Attach to process to Unity enables to deug Unity project.

The problems is the line at glPixelStorei, samplesPerPixel is 0.

  • (void)render
    {
    @synchronized(bitmap) {
    if (!needsDisplay)
    return;

    int samplesPerPixel = [bitmap samplesPerPixel];
    int rowLength = 0;
    int unpackAlign = 0;
    glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowLength);
    glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpackAlign);
    glPixelStorei(GL_UNPACK_ROW_LENGTH,
        [bitmap bytesPerRow] / samplesPerPixel);
    

Any ideas?

@endavid
Copy link

endavid commented Jun 11, 2013

Actually, it also crashes when calling SetMargins... For SetMargins, I have a fix, but because it still crashes in some situations, I haven't done any pull request yet. For SetMargins the problem is that the texture is destroyed while it may still being used by the rendering thread, since the GL.IssuePluginEvent((int)webView); issues the command but it may not be rendered until the next frame. I fixed that by temporarily disabling rendering OnGUI with a flag that is set when SetMargins is called. I yield for a couple of frames, destroy the texture, create the new one, and set the flag back to normal, so OnGUI resumes execution.

It may be unrelated to the SetVisibility crash, but I also get some texture errors when it crashes on SetVisibility. I'll try to investiga further...

As a workaround, when I'm in the editor, instead of calling obj.SetVisibility(false) I do obj.enabled = false.

#if UNITY_EDITOR
        // SetVisibility(false) makes Unity Editor crash! :(
        mWebViewObject.enabled = false;
#else       
        mWebViewObject.SetVisibility(false);
#endif

@KojiNakamaru
Copy link
Member

I've tried the latest (should be very different from one caused crashes) and it seems to cause no crash. Please reopen the issue if you need any assistance further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants