Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

COleDataSource clipboard method is crashing in Widows XP after closing the application

$
0
0

Our project(MFC Active X project) is developed using VC++ 2010.
We are using COleDataSource methods to copy data to clipboard. We are using the below code snippet to copy data on clipboard

COleDataSource* pSource = new COleDataSource();
HGLOBAL hText = ::GlobalAlloc(GMEM_SHARE, iTextSize);
LPSTR pText = (LPSTR) :: GlobalLock(hText);
ASSERT(pText);
strcpy(pText, strClipboardText);
::GlobalUnlock(hText);
pSource->CacheGlobalData(CF_TEXT, hText);
pSource->Flushclipboard();
The above code snippet is in ActiveX control. When we close the application it is crashing in XP. The same code snippet is working in Window 7.

The call stack is showing as below

    mfc100.dll!AFX_MAINTAIN_STATE2::AFX_MAINTAIN_STATE2() + 0x34 bytes    
    mfc100.dll!COleDataSource::XDataObject::GetData() + 0x1a bytes    
    ole32.dll!HandleFromHandle() + 0x23 bytes    
    ole32.dll!RenderFormat() + 0x11b bytes    
    ole32.dll!_ClipboardWndProc@16() + 0x29403 bytes    
    user32.dll!_InternalCallWinProc@20() + 0x28 bytes    
    user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes    
    user32.dll!_DispatchClientMessage@20() + 0x4d bytes    
    user32.dll!___fnDWORD@4() + 0x24 bytes    
    ntdll.dll!_RtlIpv6AddressToStringExW@20() + 0xa5 bytes    
    ole32.dll!_OleFlushClipboard@0() + 0x87 bytes    
    mfc100.dll!AfxOleTerm() + 0xa bytes    
    mfc100.dll!AfxOleTermOrFreeLib() + 0x13 bytes    
    mfc100.dll!AfxPostQuitMessage() + 0x1e bytes    
    mfc100.dll!CWnd::OnNcDestroy() + 0x4d bytes    
    mfc100.dll!CWnd::OnWndMsg() + 0x47e bytes    
    mfc100.dll!CWnd::WindowProc() + 0x24 bytes    
    mfc100.dll!AfxCallWndProc() + 0xb5 bytes    
     ...

NOTE: The same scenario is working when application build in debug mode(mfc100d.dll)


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>