scalar deleting destructor? 
Author Message
 scalar deleting destructor?

Hello,

What could be the possible reasons for this error (scalar deleting
destructor) ?

I get it for 2 items out 16 in the tree when I execute "delete pItem" in
CModelView::OnDeleteItem (see below) but all the items are created the same
way so why some give that error and not others?

void CModelView::OnDeleteItem(NMHDR* pNMHDR, LRESULT* pResult)
{
 NMTREEVIEW* pNMTreeView = (NMTREEVIEW*)pNMHDR;

 CItem* pItem = (CItem*)(pNMTreeView->itemOld.lParam);

 if (pItem)
  delete pItem;

 *pResult = 0;

Quote:
}

Here is the Call Stack:
CFolder::~CFolder() line 26
CFolder::`scalar deleting destructor'(unsigned int 1) + 100 bytes
CModelView::OnDeleteItem(tagNMHDR * 0x0012f188, long * 0x0012eee0) line 431
+ 126 bytes

CFolder is derived from CItem.

Right after the error BoundsChecker detects a memory leak of 32 bytes and
Location error points to the member "virtual UINT GetDefaultMenuItem() {
return 0; }". I guess the memory leak is "normal" because of the error above
but why on this member, what's wrong?

class CItem
{
public:
    CItem(int nType, CItem* pParent, LPCTSTR pszItemPath, int nImage, int
nSelectedImage);
    virtual ~CItem();

    ...

    virtual UINT GetDefaultMenuItem() { return 0; }

    ...

Quote:
};

Any idea and explanations would be very much appreciated. Thanks.

--
No?l
http://www.*-*-*.com/



Mon, 31 Mar 2003 03:00:00 GMT  
 scalar deleting destructor?

Hello All,

I still spent a lot of time on my problem. What I now know is that "scalar
deleting destructor" is a helper function that calls delete it is not an
error, I was misled because in some situations this helper function can
gives errors, especially problems with the stack.
In fact the problems in my case *are* the memory leaks not the "scalar
deleting destructor" in the call stacks.

So now I'd like to understand why some memory leaks occur on the
GetDefaultMenuItem() of some of the CFolder objects. If you have any ideas
please let me know. Thanks.

class CItem
{
public:
     ...
     virtual UINT GetDefaultMenuItem() { return 0; }
      ...

Quote:
};

class CFolder : public CItem
{
public:
     ...
     UINT GetDefaultMenuItem() { return ID_MENU_DEFAULT; }
      ...

Quote:
};

--
No?l


Tue, 01 Apr 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. What is a scalar deleting destructor?

2. What is a scalar deleting destructor?

3. "scalar deleting destructor"

4. "scalar deleting destructor"

5. Impossible to delete object in destructor

6. delete operator and exportable classes with virtual destructors

7. help w/ delete operator and class destructor

8. vector deleting destructor

9. Vector deleting destructor called when regular one will do

10. 'scallar deleting destructor'(unsigned int)

11. "deleting destructor" problem

12. Help with Non-Scalar

 

 
Powered by phpBB® Forum Software