[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access Violation from dialog based app in AFX_DATA_INIT

Posted on 1998-06-04
2
Medium Priority
?
343 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 300 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

834 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