Changeset 61908 in vbox
- Timestamp:
- Jun 28, 2016 1:24:52 AM (8 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
-
Additions/WINNT/VBoxTray/VBoxClipboard.cpp (modified) (2 diffs)
-
Additions/WINNT/VBoxTray/VBoxDnD.cpp (modified) (1 diff)
-
HostServices/SharedClipboard/VBoxClipboard-win.cpp (modified) (4 diffs)
-
Main/src-server/win/HostPowerWin.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r60784 r61908 659 659 } break; 660 660 661 case WM_DESTROY: 662 { 663 vboxClipboardRemoveFromCBChain(pCtx); 664 if (pCtx->timerRefresh) 665 KillTimer(pCtx->hwnd, 0); 666 /* 667 * don't need to call PostQuitMessage cause 668 * the VBoxTray already finished a message loop 669 */ 670 } break; 671 661 672 default: 662 673 { … … 732 743 if (pCtx->hwnd) 733 744 { 734 vboxClipboardRemoveFromCBChain(pCtx);735 if (pCtx->timerRefresh)736 KillTimer(pCtx->hwnd, 0);737 738 745 DestroyWindow(pCtx->hwnd); 739 746 pCtx->hwnd = NULL; -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp
r59844 r61908 289 289 { 290 290 MSG uMsg; 291 while (GetMessage(&uMsg, 0, 0, 0)) 291 BOOL fRet; 292 while ((fRet = GetMessage(&uMsg, 0, 0, 0)) > 0) 292 293 { 293 294 TranslateMessage(&uMsg); 294 295 DispatchMessage(&uMsg); 295 296 } 297 Assert(fRet >= 0); 296 298 297 299 if (ASMAtomicReadBool(&pCtx->fShutdown)) -
trunk/src/VBox/HostServices/SharedClipboard/VBoxClipboard-win.cpp
r61724 r61908 62 62 63 63 RTTHREAD thread; 64 bool volatile fTerminate;65 64 66 65 HANDLE hRenderEvent; … … 649 648 } break; 650 649 651 case WM_CLOSE: 652 { 653 /* Do nothing. Ignore the message. */ 650 case WM_DESTROY: 651 { 652 /* MS recommends to remove from Clipboard chain in this callback */ 653 Assert(pCtx->hwnd); 654 removeFromCBChain(pCtx); 655 if (pCtx->timerRefresh) 656 KillTimer(pCtx->hwnd, 0); 657 PostQuitMessage(0); 654 658 } break; 655 659 … … 716 720 717 721 MSG msg; 718 while (GetMessage(&msg, NULL, 0, 0) && !pCtx->fTerminate) 722 BOOL msgret = 0; 723 while ((msgret = GetMessage(&msg, NULL, 0, 0)) > 0) 719 724 { 720 725 TranslateMessage(&msg); 721 726 DispatchMessage(&msg); 722 727 } 723 } 724 } 725 726 if (pCtx->hwnd) 727 { 728 removeFromCBChain(pCtx); 729 if (pCtx->timerRefresh) 730 KillTimer(pCtx->hwnd, 0); 731 732 DestroyWindow (pCtx->hwnd); 733 pCtx->hwnd = NULL; 734 } 728 /* 729 * Window procedure can return error, 730 * but this is exceptional situation 731 * that should be identified in testing 732 */ 733 Assert(msgret >= 0); 734 Log(("VBoxClipboardThread Message loop finished. GetMessage returned %d, message id: %d \n", msgret, msg.message)); 735 } 736 } 737 738 pCtx->hwnd = NULL; 735 739 736 740 if (atomWindowClass != 0) … … 772 776 Log(("vboxClipboardDestroy\n")); 773 777 774 /* Set the termination flag and ping the window thread. */775 ASMAtomicWriteBool (&g_ctx.fTerminate, true);776 777 778 if (g_ctx.hwnd) 778 779 { 779 PostMessage (g_ctx.hwnd, WM_CLOSE, 0, 0);780 int rc = PostMessage (g_ctx.hwnd, WM_CLOSE, 0, 0); 780 781 } 781 782 -
trunk/src/VBox/Main/src-server/win/HostPowerWin.cpp
r60052 r61908 54 54 Log(("HostPowerServiceWin::!HostPowerServiceWin: destroy window %x\n", mHwnd)); 55 55 56 /* Is this allowed from another thread? */57 SetWindowLongPtr(mHwnd, 0, 0);58 56 /* 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); 60 58 RTThreadWait(mThread, 5000, NULL); 61 59 mThread = NIL_RTTHREAD; … … 117 115 MSG msg; 118 116 BOOL fRet; 119 while ((fRet = GetMessage(&msg, NULL, 0, 0)) !=0)117 while ((fRet = GetMessage(&msg, NULL, 0, 0)) > 0) 120 118 { 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); 131 121 } 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); 132 128 } 133 129 } 134 130 135 131 Log(("HostPowerServiceWin::NotificationThread: exit thread\n")); 136 if (hwnd)137 DestroyWindow(hwnd);138 132 139 133 if (atomWindowClass != 0) … … 214 208 } 215 209 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 216 218 default: 217 219 return DefWindowProc(hwnd, msg, wParam, lParam);
Note:
See TracChangeset
for help on using the changeset viewer.

