Click here to Skip to main content
16,005,734 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: UpdateData - Out Of Memory - Serious problem Pin
David Crow4-Jun-08 3:05
David Crow4-Jun-08 3:05 
GeneralRe: UpdateData - Out Of Memory - Serious problem Pin
Trupti Mehta4-Jun-08 5:12
Trupti Mehta4-Jun-08 5:12 
GeneralRe: UpdateData - Out Of Memory - Serious problem Pin
David Crow4-Jun-08 5:38
David Crow4-Jun-08 5:38 
AnswerRe: UpdateData - Out Of Memory - Serious problem Pin
Jijo.Raj4-Jun-08 3:14
Jijo.Raj4-Jun-08 3:14 
GeneralRe: UpdateData - Out Of Memory - Serious problem Pin
Trupti Mehta4-Jun-08 4:38
Trupti Mehta4-Jun-08 4:38 
GeneralRe: UpdateData - Out Of Memory - Serious problem Pin
Jijo.Raj4-Jun-08 8:30
Jijo.Raj4-Jun-08 8:30 
GeneralRe: UpdateData - Out Of Memory - Serious problem Pin
Trupti Mehta4-Jun-08 21:33
Trupti Mehta4-Jun-08 21:33 
GeneralRe: UpdateData - Out Of Memory - Serious problem Pin
Trupti Mehta4-Jun-08 21:58
Trupti Mehta4-Jun-08 21:58 
<blockquote class="FQ"><div class="FQA">Jijo raj wrote:</div>I can see a chance of serious synchronization error. Your UpdateData() is called after sending notification to the parent? In that case, your child dialog will get deleted by parent dialog and after deletion you might be calling UpdateData() which will endup in assertion from MFC. Its a wild guess, since i don't have the full picture of your code.</blockquote>

No Jijo, after finishing all taks only communicating with the parent happens. On user clicks to "Yes" button only the child communicates with the parent.

The child1 has a text box, user enters in it & clicks on "Get Data" btn, on that click :
void CPage1Dlg::OnGetData()
{
	AfxMessageBox(_T("Into OnGetData"));
	UpdateData(true);

	// Search operator no
	OperatorDetails od;
//	if (operatorsMap->Lookup(m_number, od) != 0) {	// Found operator number
//		m_operName = od.GetOperName();

	if (true) {
		m_operName = "Trial";
		UpdateData (false);
		AfxMessageBox(m_operName);
		EnableConfirm(true);
	} else {
		m_operName = "";
		EnableConfirm(false);
	}

	od.~OperatorDetails();
	UpdateData (true);

	return;	
}
// Enables /Disables the Confirm Y/N? & Yes,No buttons
void CPage1Dlg::EnableConfirm(bool enable)
{
	if (enable) {
		GetDlgItem(IDC_NAME_BTN)->ShowWindow(false);
		GetDlgItem(IDC_CONFIRM_LABEL)->ShowWindow(true);
		GetDlgItem(IDC_YES1_BTN)->ShowWindow(true);
		GetDlgItem(IDC_WRONG_BTN)->ShowWindow(true);
	} else {
		GetDlgItem(IDC_NAME_BTN)->ShowWindow(true);
		GetDlgItem(IDC_CONFIRM_LABEL)->ShowWindow(false);
		GetDlgItem(IDC_YES1_BTN)->ShowWindow(false);
		GetDlgItem(IDC_WRONG_BTN)->ShowWindow(false);
	}
}

Then the user has to click Yes or No button. On No, the focus again return to the text box & on yes:
void CPage1Dlg::OnYes()
{
	// Create object of OperatorDetails with provided info
	OperatorDetails* odet(m_number, m_operName);
	// Update the DeptStock
	deptStock.SetOperator(odet);
	// Free up the memory of OpertatorDetails
	free(&odet);
	odet.~OperatorDetails();

	// Communicate with the Parent
	TellParent();

	return;
}
void CPage1Dlg::TellParent()
{
//	AfxMessageBox(_T("Inside TellPArent"));

	// Update deptStock obj with the parent
	this->CRHPostMessageToParent(WM_CHANGED_DS, (int)&deptStock);
	this->ShowWindow(SW_HIDE);
	this->CRHPostMessageToParent(WM_SHOW_NEXT_VIEW, 2);
//	AfxMessageBox(_T("Finished TellParent"));

	return;
}


I hope I have made my code very clear to you. You can see the last UpdateData is called in GetData() only. The Assertion Failure & Unsupported operation was attempted message box come in GetData(), 2 times before "Trial" messagebox & 1 time after that. If I comment those 3 UpdateData in GetData(), no such exceptions/messages.

Thanks

Terry

GeneralRe: UpdateData - Out Of Memory - Serious problem Pin
Trupti Mehta5-Jun-08 2:47
Trupti Mehta5-Jun-08 2:47 
AnswerRe: UpdateData - Out Of Memory - Serious problem Pin
Artem Kustikov4-Jun-08 4:52
Artem Kustikov4-Jun-08 4:52 
GeneralRe: UpdateData - Out Of Memory - Serious problem Pin
Trupti Mehta4-Jun-08 5:15
Trupti Mehta4-Jun-08 5:15 
QuestionWhen second application runs first should be hidden Pin
VCProgrammer4-Jun-08 2:13
VCProgrammer4-Jun-08 2:13 
AnswerRe: When second application runs first should be hidden Pin
Jijo.Raj4-Jun-08 2:29
Jijo.Raj4-Jun-08 2:29 
AnswerRe: When second application runs first should be hidden Pin
Saurabh.Garg4-Jun-08 2:55
Saurabh.Garg4-Jun-08 2:55 
AnswerRe: When second application runs first should be hidden Pin
Hamid_RT4-Jun-08 21:11
Hamid_RT4-Jun-08 21:11 
QuestionCustom toolbars? Pin
Lord Kixdemp4-Jun-08 2:03
Lord Kixdemp4-Jun-08 2:03 
AnswerRe: Custom toolbars? Pin
_AnsHUMAN_ 4-Jun-08 2:07
_AnsHUMAN_ 4-Jun-08 2:07 
GeneralRe: Custom toolbars? Pin
Lord Kixdemp4-Jun-08 5:42
Lord Kixdemp4-Jun-08 5:42 
QuestionHow to get the full path of a file? Pin
CrocodileBuck4-Jun-08 1:57
CrocodileBuck4-Jun-08 1:57 
AnswerRe: How to get the full path of a file? Pin
_AnsHUMAN_ 4-Jun-08 2:02
_AnsHUMAN_ 4-Jun-08 2:02 
GeneralRe: How to get the full path of a file? Pin
CrocodileBuck4-Jun-08 2:17
CrocodileBuck4-Jun-08 2:17 
GeneralRe: How to get the full path of a file? Pin
_AnsHUMAN_ 4-Jun-08 2:23
_AnsHUMAN_ 4-Jun-08 2:23 
GeneralRe: How to get the full path of a file? Pin
CrocodileBuck4-Jun-08 2:44
CrocodileBuck4-Jun-08 2:44 
AnswerRe: How to get the full path of a file? Pin
Michael Schubert4-Jun-08 2:04
Michael Schubert4-Jun-08 2:04 
AnswerRe: How to get the full path of a file? Pin
David Crow4-Jun-08 3:45
David Crow4-Jun-08 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.