Solved

Access Violation from dialog based app in AFX_DATA_INIT

Posted on 1998-06-04
2
323 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
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Named range not carried over 10 57
Window placement 17 64
tripleUp challenge 7 65
changeXy challenge 13 57
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

16 Experts available now in Live!

Get 1:1 Help Now