Solved

Access Violation from dialog based app in AFX_DATA_INIT

Posted on 1998-06-04
2
331 Views
Last Modified: 2013-11-19
This plain and simple (that was the original goal) dialog based application is suddently issuing an access violation when a CString is being initialized, in this code:

///////////////////////////////////////////////////////////
// CMyDlg dialog

CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
      : CDialog(CMyDlg::IDD, pParent)
{
      //{{AFX_DATA_INIT(CDpKeyDlg)
      m_myText = _T("");
      //}}AFX_DATA_INIT
      // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
      m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

It stops at CString::AllocBeforeWrite(int nLen) in Strcore.cpp. I also noticed that it does not call DoDataExchange(CDataExchange* pDX) or OnInitDialog() before it enters the above code and CString initialization.

The worst is that the application was working before this came up. No major change was made, except for adding edit boxes and the variables from ClassWizard itself.

Have you any ideas of what could be happening?

RJV
0
Comment
Question by:RJV
[X]
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
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1315988
It sounds like your program may have corrupted memory before instantiating the dialog and the symptom you see is the string class failing. I would look into making sure you're not corrupting memory. Some things to check are arrays and pointers access and usage.
0
 

Author Comment

by:RJV
ID: 1315989
thui,

Seeing as you did identify the problem, here are the points.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 109
sameEnds challenge 3 193
NotAlone Challenge 20 91
unix example issues 18 112
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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

742 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