VirtualBox

Ignore:
Timestamp:
Jun 28, 2016 1:24:52 AM (8 years ago)
Author:
vboxsync
Message:

fix for ​​​​bugref:8441: improved windows procedures in Clipboard, DND and HostPowerWin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/win/HostPowerWin.cpp

    r60052 r61908  
    5454        Log(("HostPowerServiceWin::!HostPowerServiceWin: destroy window %x\n", mHwnd));
    5555
    56         /* Is this allowed from another thread? */
    57         SetWindowLongPtr(mHwnd, 0, 0);
    5856        /* Poke the thread out of the event loop and wait for it to clean up. */
    59         PostMessage(mHwnd, WM_QUIT, 0, 0);
     57        PostMessage(mHwnd, WM_CLOSE, 0, 0);
    6058        RTThreadWait(mThread, 5000, NULL);
    6159        mThread = NIL_RTTHREAD;
     
    117115            MSG msg;
    118116            BOOL fRet;
    119             while ((fRet = GetMessage(&msg, NULL, 0, 0)) != 0)
     117            while ((fRet = GetMessage(&msg, NULL, 0, 0)) > 0)
    120118            {
    121                 if (fRet != -1)
    122                 {
    123                     TranslateMessage(&msg);
    124                     DispatchMessage(&msg);
    125                 }
    126                 else
    127                 {
    128                     // handle the error and possibly exit
    129                     break;
    130                 }
     119                TranslateMessage(&msg);
     120                DispatchMessage(&msg);
    131121            }
     122            /*
     123            * Window procedure can return error,
     124            * but this is exceptional situation
     125            * that should be identified in testing
     126            */
     127            Assert(fRet >= 0);
    132128        }
    133129    }
    134130
    135131    Log(("HostPowerServiceWin::NotificationThread: exit thread\n"));
    136     if (hwnd)
    137         DestroyWindow(hwnd);
    138132
    139133    if (atomWindowClass != 0)
     
    214208        }
    215209
     210        case WM_DESTROY:
     211        {
     212            /* moved here. it can't work across theads */
     213            SetWindowLongPtr(hwnd, 0, 0);
     214            PostQuitMessage(0);
     215            return 0;
     216        }
     217
    216218        default:
    217219            return DefWindowProc(hwnd, msg, wParam, lParam);
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