[solved] Heap corruption 17.1 |
Post Reply |
Author | |
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
Posted: 22 February 2016 at 1:48pm |
I integrated 17.1 into my projects and noticed a considerable amount of heap corruption going on.
I haven't had much opportunity to track exactly where the problems are happening but the new version is definitely unstable. Noted indications of heap corruption in my application: 1. Last word of text is weirdly truncated in every MessageBox. 2. GIDPlus crashes in Flowgraph simply by opening a flowgraph. 3. Visual artifacts appear such as overdrawn lines, object placement. These problems do not occur with v. 16.26. They only appear when I link with v. 17.1. The more complex the program, the more pronounced the issue. I typically use "Yes (/LARGEADDRESSAWARE)" linker setting. On their own, the individual components seem to have no error. All indications point to something in the new DPI processing system.. somewhere. The nearest I could come to duplicating in a CJ sample was with CalendarDemo. This may or may not be related to the general condition, but the behavior is similar. 1. Build and run CalendarDemo using Static, Unicode settings. DLL seemed to produce the same results. 2. Select the test events. 3. Open options 4. Select Custom for tooltips from combobox 5. Move mouse cursor over an object with tool tips. Heap will be corrupt in method: void CWnd::FilterToolTipMessage(MSG* pMsg) if ((tiHit.lpszText != LPSTR_TEXTCALLBACK) && (tiHit.hinst == 0)) free(tiHit.lpszText); There was nothing obvious through my brief code review to indicate why this is. It's abstracted enough to be difficult to tell. Someone with more familiarity with the code base might be able to find the problem more easily. Build 17.1 Static Lib Unicode VS2010 Win 7 Pro Service Pack 1 |
|
markr
Senior Member Joined: 01 August 2004 Status: Offline Points: 443 |
Post Options
Thanks(0)
|
Out of curiosity, are you using any of the newer (Office 2013 or VS 2015) themes that make use of frame shadows?
- Mark R.
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
I didn't try a VS 2015 theme, but did test with Office 2013. The theme didn't seem to matter with regard to the problems. I used several of the different "Office" themes with no apparent difference.
I've noticed a number of topics posted here that point to memory issues. The effects seem random depending on how each application allocates memory... everything from crashes on exit to lockups during operation. |
|
markr
Senior Member Joined: 01 August 2004 Status: Offline Points: 443 |
Post Options
Thanks(0)
|
I get occasional crash reports, too, that appear to be caused by heap corruption of some type. I never saw these at all with XTP v16.x, but they now occur regularly with v17.
I'm not sure what to make of them - but I do know that in many cases the XTP hook manager (CXTPHookManager::HookWndProc) seems to be involved. Just wondering if you're seeing something similar.
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
markr - I concur with your findings. I've concluded it must be something with the skin manager hook.
More details on the FlowGraph crash that I can reproduce 100% of the time. No nodes, no connection points, no mark up, nothing. A blank FlowGraph page (with grid) should appear. Instead the program crashes with heap corruption. Ctor works fine, activation works fine. Go to draw it and it's broken badly. The problem seems to surface from this method: LRESULT WINAPI CXTPSkinManagerApiHook::OnHookCallWindowProcW(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) Example: void CXTPFlowGraphControl::OnPaint() { .... >>> Crash here delete pDC; .... Which is calling this: CXTPFlowGraphDrawContextGdiPlus::~CXTPFlowGraphDrawContextGdiPlus() { SAFE_DELETE(m_pActivePen); SAFE_DELETE(m_pActiveFont); for (int i = 0; i < m_nBrushCount; i++) { >>>> Crash here delete m_arrBrushes.pBrush; } delete m_pGraphics; } The skin system appears problematic with v17+. Win 7 pro VS 2010 Static unicode debug build CJ v 17.2.0 |
|
astoyan
Admin Group Joined: 24 August 2013 Status: Offline Points: 304 |
Post Options
Thanks(0)
|
The first reported issue with CalendarDemo has been fixed. It has nothing to do about ToolkitPro version, it's a bug in the sample:
Index: ToolkitPro/Samples/Calendar/CalendarDemo/CalendarDemoView.cpp =================================================================== --- ToolkitPro/Samples/Calendar/CalendarDemo/CalendarDemoView.cpp (revision 17881) +++ ToolkitPro/Samples/Calendar/CalendarDemo/CalendarDemoView.cpp (revision 17882) @@ -1426,11 +1426,9 @@ hitTest.pViewEvent->GetEvent()->GetSubject() ); - int nBuffSize = strToolText.GetLength()*2 +10; - TCHAR* pBuffer = (TCHAR*)malloc(nBuffSize); - - STRCPY_S(pBuffer, nBuffSize, (LPCTSTR)strToolText); - + int nTextSize = strToolText.GetLength() + 1; + TCHAR* pBuffer = (TCHAR*)::calloc(nTextSize, sizeof(TCHAR)); + STRCPY_S(pBuffer, nTextSize, (LPCTSTR)strToolText); pTI->lpszText = pBuffer; Regards, Alexander
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
Thanks for the fix astoyan. That corrected custom tooltips.
|
|
astoyan
Admin Group Joined: 24 August 2013 Status: Offline Points: 304 |
Post Options
Thanks(0)
|
I have tried to reproduce it in our FlowGraphSample by modifying it so that it shows a blan page with grid and it worked just fine. Can you please make and submit a simple sample that crashes for you? Regards, Alexander
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |