Application getting carshed in release mode not in debug, in the follwing scenario
-
Hi Developers, Today I ahve faced a strange issue, that my application is gettong crsshed in release exe but not in debug mode. The scenario is that i am clicking on the items of a tree controls very rapidly. It is searching functionality & top searched (from the user) has given on the tree. Code of click event of that tree is mapped like this ON_NOTIFY(NM_CLICK, IDC_TREETOPSEARCH, &CRepLiveSearch::OnClickTopSearch) And the function is here. UINT uiFlags = 0; const MSG* pMsg = GetCurrentMessage(); CTreeCtrl* pTreeCtrl = (CTreeCtrl*)GetDlgItem(pNMHDR->idFrom); CPoint point(pMsg->pt); pTreeCtrl->ScreenToClient(&point); HTREEITEM ht = pTreeCtrl->HitTest(point, &uiFlags); CString szSelWord = m_suggestionTree.GetItemText(ht); szSelWord = szSelWord.Left(szSelWord.Find('(')); m_edSearch.SetWindowText(szSelWord); *pResult = 0; Can u tell me what may be the problem. Thanks. Amrit Agrawal. Software Developer
-
Hi Developers, Today I ahve faced a strange issue, that my application is gettong crsshed in release exe but not in debug mode. The scenario is that i am clicking on the items of a tree controls very rapidly. It is searching functionality & top searched (from the user) has given on the tree. Code of click event of that tree is mapped like this ON_NOTIFY(NM_CLICK, IDC_TREETOPSEARCH, &CRepLiveSearch::OnClickTopSearch) And the function is here. UINT uiFlags = 0; const MSG* pMsg = GetCurrentMessage(); CTreeCtrl* pTreeCtrl = (CTreeCtrl*)GetDlgItem(pNMHDR->idFrom); CPoint point(pMsg->pt); pTreeCtrl->ScreenToClient(&point); HTREEITEM ht = pTreeCtrl->HitTest(point, &uiFlags); CString szSelWord = m_suggestionTree.GetItemText(ht); szSelWord = szSelWord.Left(szSelWord.Find('(')); m_edSearch.SetWindowText(szSelWord); *pResult = 0; Can u tell me what may be the problem. Thanks. Amrit Agrawal. Software Developer
Validate the pointers and HTREEITEM
CTreeCtrl* pTreeCtrl = (CTreeCtrl*)GetDlgItem(pNMHDR->idFrom);
//add this checking
if(!pTreeCtrl)
{
// Some message and return
}also
HTREEITEM ht = pTreeCtrl->HitTest(point, &uiFlags);
// add this checking
if (ht != NULL)
{
pTreeCtrl->Select(ht, TVGN_CARET);
}
else
{
// Show some error message/return
} -
Validate the pointers and HTREEITEM
CTreeCtrl* pTreeCtrl = (CTreeCtrl*)GetDlgItem(pNMHDR->idFrom);
//add this checking
if(!pTreeCtrl)
{
// Some message and return
}also
HTREEITEM ht = pTreeCtrl->HitTest(point, &uiFlags);
// add this checking
if (ht != NULL)
{
pTreeCtrl->Select(ht, TVGN_CARET);
}
else
{
// Show some error message/return
} -
Hi Developers, Today I ahve faced a strange issue, that my application is gettong crsshed in release exe but not in debug mode. The scenario is that i am clicking on the items of a tree controls very rapidly. It is searching functionality & top searched (from the user) has given on the tree. Code of click event of that tree is mapped like this ON_NOTIFY(NM_CLICK, IDC_TREETOPSEARCH, &CRepLiveSearch::OnClickTopSearch) And the function is here. UINT uiFlags = 0; const MSG* pMsg = GetCurrentMessage(); CTreeCtrl* pTreeCtrl = (CTreeCtrl*)GetDlgItem(pNMHDR->idFrom); CPoint point(pMsg->pt); pTreeCtrl->ScreenToClient(&point); HTREEITEM ht = pTreeCtrl->HitTest(point, &uiFlags); CString szSelWord = m_suggestionTree.GetItemText(ht); szSelWord = szSelWord.Left(szSelWord.Find('(')); m_edSearch.SetWindowText(szSelWord); *pResult = 0; Can u tell me what may be the problem. Thanks. Amrit Agrawal. Software Developer
You should also check that the function prototype for CRepLiveSearch::OnClickTopSearch matches the correct signature. I had issues in the past where this did not match and would crash in release, but work ok in debug
If you vote me down, my score will only get lower
-
Hi Developers, Today I ahve faced a strange issue, that my application is gettong crsshed in release exe but not in debug mode. The scenario is that i am clicking on the items of a tree controls very rapidly. It is searching functionality & top searched (from the user) has given on the tree. Code of click event of that tree is mapped like this ON_NOTIFY(NM_CLICK, IDC_TREETOPSEARCH, &CRepLiveSearch::OnClickTopSearch) And the function is here. UINT uiFlags = 0; const MSG* pMsg = GetCurrentMessage(); CTreeCtrl* pTreeCtrl = (CTreeCtrl*)GetDlgItem(pNMHDR->idFrom); CPoint point(pMsg->pt); pTreeCtrl->ScreenToClient(&point); HTREEITEM ht = pTreeCtrl->HitTest(point, &uiFlags); CString szSelWord = m_suggestionTree.GetItemText(ht); szSelWord = szSelWord.Left(szSelWord.Find('(')); m_edSearch.SetWindowText(szSelWord); *pResult = 0; Can u tell me what may be the problem. Thanks. Amrit Agrawal. Software Developer
Amrit Agr wrote:
...my application is gettong crsshed...
Crashed is such a meaningless term without any context.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous