Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

stop in winhand for DEBUG version and OK  in Release version

Posted on 1997-05-18
6
521 Views
Last Modified: 2013-11-19
Hi,have a nice day.
A project runs through winhand.cpp in OnTimer.
Here is winhand.cpp.
void CHandleMap::RemoveHandle(HANDLE h)
{
#ifdef _DEBUG
// make sure the handle entry is consistent
CObject* pTemp;
if (LookupTemporary(h, pTemp))
{
  // temporary objects must have correct handle values
  HANDLE* ph = (HANDLE*)(pTemp + 1);  // after CObject
  ASSERT(ph[0] == h);  //<----- (****)

When the project runs in DEBUG model,
after some minutes, assertion failed in (****)
But in RELEASE model, it is OK.
More informations are DEBUG model,ph[0] and h are
increasing when running and I work in Visual C++ 1.0.
The question is
1. Is it truely OK when RELEASE version?
2. How can I debug the problem when DEBUG version?
Any suggestions are useful for me. Thanks.
0
Comment
Question by:mathematics
  • 3
  • 3
6 Comments
 

Author Comment

by:mathematics
ID: 1301628
Edited text of question
0
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 1301629
1. Is it truely OK when RELEASE version?
No, I don't think so. Never ignore ASSERT failure. It is likely that there is a bug in your program.

2. How can I debug the problem when DEBUG version?
It is not trivial. I think the bug is related to some code about CWnd (create, destroy). I suggest to reduce your code, remove the unrelated code for the time being. Then, it is easier to debug.

0
 

Author Comment

by:mathematics
ID: 1301630
More informations
AfxSig_vv->
CView::OnPain->
CPaintDC::~CPaintDC->
CDC::ReleaseAttribDC->
CHandleMap::RemoveHandle
the ClientDC in
   void CSplitterWnd::OnPaint()
deleted when completed OnPaint.
More Question is
Can we run OnTimer conatined a CSpliiterWnd?
(Because a splitter rect drawn in the middle of views.
 And the drawing action can't do in timing,I think!)
Hope help!
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 23

Expert Comment

by:chensu
ID: 1301631
It looks like the exception is caused by something about CDC. Do you use CClientDC in CSplitterWnd::OnPaint()? Use CPaintDC instead of CClientDC in OnPaint().

You can perform some action about CSplitterWnd in OnTimer.

0
 

Author Comment

by:mathematics
ID: 1301632
Recently,I change memory model of the project with large.
Then it's OK when DEBUG version.
I don't know why. If you know, hope tell me. Thanks.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1301633
If some errors disappear when changing memory model, there are some possibilities. In your case, it is likely that there are too much data that medium memory model cannot handle, and DEBUG version has more data than RELEASE version.


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.

840 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