VirtualBox

Changeset 36047 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 21, 2011 10:32:25 PM (14 years ago)
Author:
vboxsync
Message:

crOpenGL: fix crash on win hosts when forced shutting down a vm (#6443)

File:
1 edited

Legend:

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

    r33540 r36047  
    407407    if (render_spu.dwWinThreadId)
    408408    {
    409         PostThreadMessage(render_spu.dwWinThreadId, WM_QUIT, 0, 0);
    410         WaitForSingleObject(render_spu.hWinThreadReadyEvent, INFINITE);
     409        HANDLE hNative;
     410
     411        hNative = OpenThread(SYNCHRONIZE|THREAD_QUERY_INFORMATION|THREAD_TERMINATE,
     412                             false, render_spu.dwWinThreadId);
     413        if (!hNative)
     414        {
     415            crWarning("Failed to get handle for window thread(%#x)", GetLastError());
     416        }
     417
     418        if (PostThreadMessage(render_spu.dwWinThreadId, WM_QUIT, 0, 0))
     419        {
     420            WaitForSingleObject(render_spu.hWinThreadReadyEvent, INFINITE);
     421
     422            /*wait for os thread to actually finish*/
     423            if (hNative && WaitForSingleObject(hNative, 3000)==WAIT_TIMEOUT)
     424            {
     425                crDebug("Wait failed, terminating");
     426                if (!TerminateThread(hNative, 1))
     427                {
     428                    crWarning("TerminateThread failed");
     429                }
     430            }
     431        }
     432
     433        if (hNative)
     434        {
     435            CloseHandle(hNative);
     436        }
    411437    }
    412438    CloseHandle(render_spu.hWinThreadReadyEvent);
Note: See TracChangeset for help on using the changeset viewer.

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