- Timestamp:
- Jul 20, 2023 1:20:29 PM (19 months ago)
- svn:sync-xref-src-repo-rev:
- 158505
- Location:
- trunk/src/VBox/GuestHost/SharedClipboard
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardDataObjectImpl-win.cpp
r100664 r100665 49 49 #include <iprt/errcore.h> 50 50 #include <VBox/log.h> 51 52 /** Enable this to track the current counts of the data / stream / enum object we create + supply to the Windows clipboard. 53 * Helps finding refcount issues or tracking down memory leaks. */ 54 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 55 int g_cDbgDataObj; 56 int g_cDbgStreamObj; 57 int g_cDbgEnumFmtObj; 58 #endif 51 59 52 60 /** @todo Also handle Unicode entries. … … 66 74 , m_EventStatusChanged(NIL_RTSEMEVENT) 67 75 { 76 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 77 g_cDbgDataObj++; 78 LogFlowFunc(("g_cDataObj=%d, g_cStreamObj=%d, g_cEnumFmtObj=%d\n", g_cDbgDataObj, g_cDbgStreamObj, g_cDbgEnumFmtObj)); 79 #endif 68 80 } 69 81 … … 71 83 { 72 84 Destroy(); 85 86 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 87 g_cDbgDataObj--; 88 LogFlowFunc(("g_cDataObj=%d, g_cStreamObj=%d, g_cEnumFmtObj=%d\n", g_cDbgDataObj, g_cDbgStreamObj, g_cDbgEnumFmtObj)); 89 #endif 73 90 74 91 LogFlowFunc(("mRefCount=%RI32\n", m_lRefCount)); … … 250 267 251 268 if (m_pStream) 252 {253 m_pStream->Release();254 269 m_pStream = NULL; 255 }256 270 257 271 if (m_pFormatEtc) -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardEnumFormatEtcImpl-win.cpp
r100204 r100665 40 40 41 41 42 /********************************************************************************************************************************* 43 * Structures and Typedefs * 44 *********************************************************************************************************************************/ 45 46 47 48 /********************************************************************************************************************************* 49 * Static variables * 50 *********************************************************************************************************************************/ 51 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 52 extern int g_cDbgDataObj; 53 extern int g_cDbgStreamObj; 54 extern int g_cDbgEnumFmtObj; 55 #endif 56 42 57 43 58 SharedClipboardWinEnumFormatEtc::SharedClipboardWinEnumFormatEtc(void) … … 45 60 m_nIndex(0) 46 61 { 62 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 63 g_cDbgEnumFmtObj++; 64 LogFlowFunc(("g_cDataObj=%d, g_cStreamObj=%d, g_cEnumFmtObj=%d\n", g_cDbgDataObj, g_cDbgStreamObj, g_cDbgEnumFmtObj)); 65 #endif 47 66 } 48 67 … … 52 71 53 72 LogFlowFunc(("m_lRefCount=%RI32\n", m_lRefCount)); 73 74 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 75 g_cDbgEnumFmtObj--; 76 LogFlowFunc(("g_cDataObj=%d, g_cStreamObj=%d, g_cEnumFmtObj=%d\n", g_cDbgDataObj, g_cDbgStreamObj, g_cDbgEnumFmtObj)); 77 #endif 54 78 } 55 79 -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp
r100509 r100665 52 52 * Static variables * 53 53 *********************************************************************************************************************************/ 54 54 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 55 extern int g_cDbgDataObj; 56 extern int g_cDbgStreamObj; 57 extern int g_cDbgEnumFmtObj; 58 #endif 55 59 56 60 … … 69 73 70 74 LogFunc(("m_strPath=%s\n", m_strPath.c_str())); 75 76 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 77 g_cDbgStreamObj++; 78 LogFlowFunc(("g_cDataObj=%d, g_cStreamObj=%d, g_cEnumFmtObj=%d\n", g_cDbgDataObj, g_cDbgStreamObj, g_cDbgEnumFmtObj)); 79 #endif 71 80 } 72 81 … … 74 83 { 75 84 LogFlowThisFuncEnter(); 85 86 #ifdef VBOX_SHARED_CLIPBOARD_DEBUG_OBJECT_COUNTS 87 g_cDbgStreamObj--; 88 LogFlowFunc(("g_cDataObj=%d, g_cStreamObj=%d, g_cEnumFmtObj=%d\n", g_cDbgDataObj, g_cDbgStreamObj, g_cDbgEnumFmtObj)); 89 #endif 76 90 } 77 91 … … 376 390 if (pStream) 377 391 { 378 pStream->AddRef();379 380 392 *ppStream = pStream; 381 393 return S_OK; -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp
r100661 r100665 1065 1065 if (RT_SUCCESS(rc)) 1066 1066 { 1067 if (pWinCtx->pDataObjInFlight == NULL) 1068 { 1069 SharedClipboardWinDataObject *pObj = new SharedClipboardWinDataObject(); 1070 if (pObj) 1067 LogFlowFunc(("pWinCtx->pDataObjInFlight=%p\n", pWinCtx->pDataObjInFlight)); 1068 1069 /* Create a new data object here, assign it as the the current data object in-flight and 1070 * announce it to Windows below. 1071 * 1072 * The data object will be deleted automatically once its refcount reaches 0. 1073 */ 1074 SharedClipboardWinDataObject *pObj = new SharedClipboardWinDataObject(); 1075 if (pObj) 1076 { 1077 rc = pObj->Init(pCtx, pCallbacks); 1078 if (RT_SUCCESS(rc)) 1071 1079 { 1072 rc = pObj->Init(pCtx, pCallbacks);1073 1080 if (RT_SUCCESS(rc)) 1074 { 1075 if (RT_SUCCESS(rc)) 1076 pWinCtx->pDataObjInFlight = pObj; 1077 } 1081 pWinCtx->pDataObjInFlight = pObj; 1078 1082 } 1079 else1080 rc = VERR_NO_MEMORY;1081 }1083 } 1084 else 1085 rc = VERR_NO_MEMORY; 1082 1086 1083 1087 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.