Solved

_CrtlsValidHeapPointer(pUserData)

Posted on 1998-04-02
7
469 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 157
viewing source code from eclipse 13 88
withoutTen challenge 14 99
Detect file exist or not 3 130
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 …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now