VirtualBox

Changeset 17482 in vbox for trunk


Ignore:
Timestamp:
Mar 6, 2009 3:49:42 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
43908
Message:

crOpenGL: fixed VM hangs when starting guests with 3D acceleration enabled (public bug #3437)

Location:
trunk/src/VBox/HostServices/SharedOpenGL/render
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c

    r15532 r17482  
    6969
    7070    (void) unused;
     71
     72    /* Force system to create the message queue.
     73     * Else, there's a chance than render spu will issue PostThreadMessage
     74     * before this thread calls GetMessage for first time.
     75     */
     76    PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
    7177
    7278    crDebug("RenderSPU: Window thread started (%x)", crThreadID());
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c

    r15532 r17482  
    4747    vrdw.hWnd = window->hWnd;
    4848
    49     PostThreadMessage(render_spu.dwWinThreadId, WM_VBOX_RENDERSPU_DESTROY_WINDOW, 0, (LPARAM) &vrdw);
    50     WaitForSingleObject(render_spu.hWinThreadReadyEvent, INFINITE);
     49    if (render_spu.dwWinThreadId)
     50    {
     51        PostThreadMessage(render_spu.dwWinThreadId, WM_VBOX_RENDERSPU_DESTROY_WINDOW, 0, (LPARAM) &vrdw);
     52        WaitForSingleObject(render_spu.hWinThreadReadyEvent, INFINITE);
     53    }
     54    else
     55    {
     56        crError("Render SPU: window thread is not running");
     57    }
    5158
    5259    window->hWnd = NULL;
     
    674681        cs.hInstance    = hinstance;
    675682
    676         PostThreadMessage(render_spu.dwWinThreadId, WM_VBOX_RENDERSPU_CREATE_WINDOW, 0, (LPARAM) &cs);
    677         WaitForSingleObject(render_spu.hWinThreadReadyEvent, INFINITE);
    678     }
    679    
     683        if (render_spu.dwWinThreadId)
     684        {
     685            DWORD res;
     686            int cnt=0;
     687
     688            if (!PostThreadMessage(render_spu.dwWinThreadId, WM_VBOX_RENDERSPU_CREATE_WINDOW, 0, (LPARAM) &cs))
     689            {
     690                crError("Render SPU: PostThreadMessage failed with %i", GetLastError());
     691                return GL_FALSE;
     692            }
     693
     694            do
     695            {
     696                res = WaitForSingleObject(render_spu.hWinThreadReadyEvent, 1000);
     697                cnt++;
     698            }
     699            while ((res!=WAIT_OBJECT_0) && (cnt<10));
     700
     701            crDebug("Render SPU: window thread waited %i secs", cnt);
     702
     703            if (res!=WAIT_OBJECT_0)
     704            {
     705                crError("Render SPU: window thread not responded after %i tries", cnt);
     706                return GL_FALSE;
     707            }
     708        }
     709        else
     710        {
     711            crError("Render SPU: window thread is not running");
     712            return GL_FALSE;
     713        }
     714    }
    680715
    681716    if ( !window->hWnd )
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette