Print Page | Close Window

Damage : on client block during Remove..

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=2613
Printed Date: 10 June 2024 at 7:58am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Damage : on client block during Remove..
Posted By: roberto
Subject: Damage : on client block during Remove..
Date Posted: 21 July 2005 at 9:17am

Hi all,

i've experienced some problems with PropertyGrid, more precisely i get an exception from the debugger when trying to call Remove from a PropertygridItem object... i looked at the samples and the same code has no problem there... is there any precaution i should take before removing items in a propertygrid ? thanks

 




Replies:
Posted By: Oleg
Date Posted: 21 July 2005 at 11:26pm

Hello, roberto

Hmm... may be you can sent backtrace log to see?



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: roberto
Date Posted: 22 July 2005 at 3:57am

Hi,

Using DCRT libraries and performing some memory checks

(     // Turn on the full heap checking
    _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF       |
                      _CRTDBG_CHECK_ALWAYS_DF    |
                      _CRTDBG_DELAY_FREE_MEM_DF  |
                      _CRTDBG_LEAK_CHECK_DF       ) ;

, i realized that the problem comes when allocating a propertygriditem :


int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{


  // gas tt
 ASSERT ( _CrtCheckMemory ( ) ) ;

 // ********************* Main Frame
 if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
 {
  TRACE("Failed to create FrameWindow\r\n");
  return -1;
 }
 m_PropertyGrid.Create( CRect(0,0,0,0), AfxGetMainWnd(), 0);
 CXTPPropertyGridItem* pFisse = m_PropertyGrid.AddCategory(_T("cat"));
  // gas tt
 ASSERT ( _CrtCheckMemory ( ) ) ;  <---- everything ok at this point

 CXTPPropertyGridItem* child = new CXTPPropertyGridItem(_T("key"),_T("val")); <-- _CrtCheckMemory ( ) complains here !!
 pFisse->AddChildItem(child);
 child->Remove();

 

Any idea about what causes this problem?

thanx in advance



Posted By: Oleg
Date Posted: 22 July 2005 at 11:09am

All seems ok... one thing can be problem.

try to replace

 m_PropertyGrid.Create( CRect(0,0,0,0), AfxGetMainWnd(), 0);

to

 m_PropertyGrid.Create( CRect(0,0,0,0), this, 0);

 

because AfxGetMainWnd() will return NULL in CMainFrame::OnCreate..

 

May be you can isolate the problem with new sample and attach it here?



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: roberto
Date Posted: 27 July 2005 at 3:55am

i realized what the problem was ...

on project properties there was a non standard option checked:

in c++ / code generation / struct member alignment - there was 1 byte (zp1) instead of Default..

i lost three days around that trivial thing, damn...

thank you guys anyway for your suggestions...




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net