Error Debug Assertion Failed!

Pages: 123
Thomas,

It turns out that even though these changes that I applied allowed the program to compile and run, there is still a problem.

One of the options off of the File menu is "Filters". When I select that option, it gives this error: https://drive.google.com/open?id=0B3Jw7h2K4ZvkQ3JJTUJWa1JfSWc

I think it is related to the original error that I posted here, since it involves filters.

Can you provide any help to try to figure out what this problem is?

Thanks,
Tony
Can you upload the current code somewhere ?
Thomas,

I'm sorry this took so long. I wanted to put the OpenSSL-Win32 folder in the solution folder so that you would have everything you need to compile. There are still two issues with it, but I hope you can figure it out.

One is, for some reason it won't find the crypto.h include file even though the include directories are pointing to the OpenSSL-Win32 folder inside the solution folder. I can't figure that out.

Two is, you will probably will have to change this line in the ssl.h file: # include <C:\Users\Tony\Documents\Visual Studio 2015\Projects\Magic2015\OpenSSL-Win32\include/openssl/e_os2.h>

I hope this allows you to compile and debug if needed.

Here is the link to the download the zip file containing everything you need: https://drive.google.com/open?id=0B3Jw7h2K4ZvkNy1hLUh5MnRaU1k

Can you let me know after you download it so that I can disable the link?

Thanks,
Tony
OK, I got it and will look at it tomorrow morning.
Thanks Thomas.
Hi Tony,

finally I managed to build and run your program. However I can't see a problem. When I click on Filter... a dialog opens - see https://www.dropbox.com/s/armm1ckdybp0dgs/Tony_1.png?dl=0
Is there anything you want me to try ?
Thomas,

Thanks for your help with this problem.

I think you are not getting an error because you don't have a filter in the filters list. In my testing, I am using a file that is populated with mailboxes and filters.

I tested it by creating an empty document(File/New) and not adding any filters and it indeed ran without error. I added a filter and saved the document and ran it again. It did give the error after that, since there is an existing filter.

Can you possibly try it by adding a filter?

The filter does not really have to make sense and the program will ask you to save the document somewhere(on File/Exit). You can save it anywhere.

Run it again and try the filter option again. It should give the error.

Thanks,
Tony
OK, I created a filter, saved it, closed the program. Started the program again, clicked open, loaded the file and when I clicked filters I got this MessageBox.
https://www.dropbox.com/s/pb55mecvg12pidn/Tony_2.png?dl=0
After I clicked OK the filter dialog appeared.
Thomas,

Yes, sometimes I get that also. That is not supposed to happen. It should go into the filters dialog as it did when you first tried it.

Sometimes, it just gives an error like when Internet Explorer bombs out with "The pop3 program has stopped working" and it gives me the option to debug or close the program.

In either case, it should work. I have been using the Visual Studio 6.0 executable for years and it never gave any errors.

I can't find "The parameter is incorrect" anywhere in the program.

I can't explain why it gives different messages at different times.

Are you trying it in debug mode?

Thanks,
Tony


I can't find "The parameter is incorrect" anywhere in the program.
Maybe this message is from MFC.

Are you trying it in debug mode?
Yes, I did.

I think to problem is in the Filters Dialog. Maybe sth. with the ListBox index.
For some strange reasons I can't compile it anymore so I can't tell you more.
Since my last VS Update I can run it only in Release mode, it runs fine. No problems at all.
Very strange behaviour.
OK, now it runs in Debug mode again and I found one error. It happens when you load a empty file.
1
2
3
4
5
6
void DFilters::GetData()
{
...
m_Filters.Copy(theApp.m_Filters);
...
}
Looks like that CArray fires an assertion when you try to copy from an empty CArray.
Thomas,

Thanks for your help in trying to resolve this error.

If I stop the program on that line "m_Filters.Copy(theApp.m_Filters);" and use F11, it goes to this method and bombs out there.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CMailFilter& CMailFilter::operator=(const CMailFilter& src)
{
	m_sMailBox = src.m_sMailBox;
	m_Color = src.m_Color;
	m_dwAction = src.m_dwAction;
	m_sName = src.m_sName;
	
	m_nCombination = src.m_nCombination;
	for (int i=0; i<nConditions; i++)
	{
		m_aCnd[i].m_nField = src.m_aCnd[i].m_nField;
		m_aCnd[i].m_nOperation = src.m_aCnd[i].m_nOperation;
		m_aCnd[i].m_sText = src.m_aCnd[i].m_sText;
	}

	return *this;
}


This seems to be copying the members from one CMailFilter object to another.

Does this execute automatically because of the copy statement in Get_Data?

Thanks,
Tony
Very strange, when I am on that line "m_Filters.Copy(theApp.m_Filters);" and use F11 it goes straight to the CArray::Copy
1
2
3
4
5
6
7
8
9
10
11
12
template<class TYPE, class ARG_TYPE>
void CArray<TYPE, ARG_TYPE>::Copy(const CArray& src)
{
	ASSERT_VALID(this);
	ASSERT(this != &src);   // cannot append to itself

	if(this != &src)
	{
		SetSize(src.m_nSize);
		CopyElements<TYPE>(m_pData, src.m_pData, src.m_nSize);
	}
}


Anyway, I think the CMailItem doesn't need a copy constructor and assignment operator since it doesn't allocate any dynamic memory.
Thomas,

If I remove all of the lines from
CMailFilter& CMailFilter::operator=(const CMailFilter& src)
except
return *this;
,
then select filters from the menu, it gives me a filters dialog box, but with six filters without any data.

I'm not sure of what that means, but I tried it because of what you said in your last post. I'm sure it makes sense to you.

Thanks for your help in this matter.

Tony
Last edited on
Also,

If I remove the the copy contructor for the CMailFilter Struct, I get this compile error:
Error	C2280	'CMailFilter::CMailFilter(const CMailFilter &)': attempting to reference a deleted function


On this line:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void DFilters::OnFltDown() 
{
	if (m_nCurSel<0 || m_nCurSel>=m_Filters.GetSize()-1)
		return;
	CMailFilter mf = m_Filters[m_nCurSel];
	m_Filters[m_nCurSel] = m_Filters[m_nCurSel+1];
	m_Filters[m_nCurSel+1] = mf;
	m_lbList.DeleteString(m_nCurSel);
	m_lbList.InsertString(m_nCurSel+1, mf.m_sName);
	m_lbList.SetCurSel(m_nCurSel+1);
	m_lbList.SetCheck(m_nCurSel+1, (mf.m_dwAction & MFA_ENABLED)!=0 );
	m_nCurSel = m_nCurSel+1;
	OnSelchangeList();
}


Thanks,
Tony
Ok, then leave it as it is.
Before trying to copy check if there are any filters
1
2
3
4
5
6
7
void DFilters::GetData()
{
   ... 
   if (m_Filters.GetSize() > 0)
      m_Filters.Copy(theApp.m_Filters);
   ...
}
Since the copy statement indicates it is copying from theApp.m_Filters to m_Filters, shouldn't the test be if (theApp.m_Filters.GetSize() > 0)?

Thanks,
Tony
Last edited on
Thomas,

Thanks for your help in trying to fix this problem.

I am going to put everything back to the way it was. With these changes that I made, it helped in getting me a filters dialog box with blank filters, but it caused another problem where I can't run the program with a new empty file.

Somehow, I will have to figure out how to fix the original problem that I started this post for.

Thanks,
Tony
Since the copy statement indicates it is copying from theApp.m_Filters to m_Filters, shouldn't the test be if (theApp.m_Filters.GetSize() > 0)?


Of course, silly mistake from me.
Pages: 123