Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - Damage : on client block during Remove..
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Damage : on client block during Remove..

 Post Reply Post Reply
Author
Message
roberto View Drop Down
Newbie
Newbie


Joined: 21 July 2005
Location: Italy
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote roberto Quote  Post ReplyReply Direct Link To This Post Topic: Damage : on client block during Remove..
    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

 



Edited by roberto
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
roberto View Drop Down
Newbie
Newbie


Joined: 21 July 2005
Location: Italy
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote roberto Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
roberto View Drop Down
Newbie
Newbie


Joined: 21 July 2005
Location: Italy
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote roberto Quote  Post ReplyReply Direct Link To This Post 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...

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.