Solved

_CrtlsValidHeapPointer(pUserData)

Posted on 1998-04-02
7
522 Views
Last Modified: 2013-11-20
WinNT4 SP3, VC5,

During exiting of program give the below assertion error:
_CrtlsValidHeapPointer(pUserData).  Pressing the debug button brings me to DBGHeap.C.

        _ASSERTE(_CrtIsValidHeapPointer(pUserData));

When i debug from ExitInstance(), it leads me to the below in CRT0CAT.C

           if (__onexitbegin) {
                _PVFV * pfend = __onexitend;

                while ( --pfend >= __onexitbegin )
                /*
                 * if current table entry is non-NULL,
                 * call thru it.
                 */
                if ( *pfend != NULL )
                    (**pfend)(); // Assert error...
            }


What is cause of this problem?

I have exited the ExitInstance(), does that mean that all my view, doc, has been successfully deleted? There where does the bad pointer comes from?

However in Release mode, exiting doesn't give any problem.
Is there is time bomb on the Release version?
0
Comment
Question by:engllf
  • 5
  • 2
7 Comments
 

Author Comment

by:engllf
ID: 1317396
Edited text of question
0
 
LVL 7

Accepted Solution

by:
galkin earned 50 total points
ID: 1317397
Usually this debug aasertion occurs when you delete object that is embedded to another object, so its destructor is called twice. For instance if there is a a object of type CWnd embedded in other class and you try to call delete from this object's PostNcDestroy overrride
0
 

Author Comment

by:engllf
ID: 1317398
If i send out a Release version with this problem, what will be the consequenses? System crash?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:engllf
ID: 1317399
What i have is just a SDI with 2 pane splitter wnd.  
Simply launch the application, do nothing, exit the application already gives this problem.  What a terrible headache ...
0
 

Author Comment

by:engllf
ID: 1317400
I have stripped my application to

BOOL CIPD_WINDDEApp::InitInstance()
{
 return FALSE; // immediate exit
}

Still give me the problem. Now where does the CWnd comes from?
 
0
 
LVL 7

Expert Comment

by:galkin
ID: 1317401
I gave you only an exaple what could cause a problem. Anywhay this debug function is called when heap corruption occurs. If your application is not large could you send it to me so I will be able to review it. My E-mail: agalkin@matlensilver.com
0
 

Author Comment

by:engllf
ID: 1317402
Thanx galkin,
I manage to solve the problem.
I guess the bad pointer is some
char* i defined in the CWinApp class.
After moving them out of the CWinApp
and define them as global variables,
no more assert failure.

leow
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
VBA "SendKeys" Syntax for Multiple Keystrokes 7 117
lucky13 challenge 11 153
scoreUp challenge 14 63
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question