Hi all,

I seem to be having a problem where I get memory errors upon calling the line below (#*#*#) in this function:

First-chance exception at 0x00569f26 in ScrollingPlot.exe: 0xC0000005: Access violation reading location 0x1502b60c.
First-chance exception at 0x00569f26 in ScrollingPlot.exe: 0xC0000005: Access violation reading location 0x1502b60c.
First-chance exception at 0x7c812a5b in ScrollingPlot.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x7c812a5b in ScrollingPlot.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
Unhandled exception at 0x00569f26 in ScrollingPlot.exe: 0xC0000005: Access violation reading location 0x1502b60c.
Code:
SingleList<double> * arrayList;

...

arrayList = new SingleList<double>[numwindows];
Code:
void ScrollingPlotFrame::sampleRate(GraphWin *child, int index, int rate)
{
	SingleList<double> *list;
	SingleList<double> *tempList;
	tempList = new SingleList<double>; 
	SingleNode<double> * current;
	list = &arrayList[index];

	if(list!=NULL)
	{
		current = list->head(); // *#*#* crashing here when creating  new window #*#*#

		bool atleastone=false; // only pass back list if there is at least one value

		int ratecount = 0;
		int count=0;


		if(current != NULL)
		{
			double avg = current->xretrieve();

			while(current != NULL) 
			{
				if( ratecount == 0) //retrieve data 
					avg = current->xretrieve();

				if(ratecount == rate-1) //average values and add to list
				{
					ratecount = 0;
					double val = avg/double(rate);
					tempList->push_back(val,0); 
					atleastone=true;
					//timer_.Stop();
				}
				else //keep running total
				{
					avg = avg + current ->next() ->xretrieve();
					ratecount++;	
				}
				current = current->next();
				count++;
			}

			
			if(atleastone)
			{		
				child->setList(*tempList,index); //end of list, so send averaged data list to child window	
			}
		}
		child->PlotIt(false); //replot
	}
	else
	{
			wxString newtext;
			newtext = wxT(" NULL LIST");
			wxMessageBox(newtext,
                     _T("Modeless dialog"),
                     wxOK | wxICON_INFORMATION, this);
	}



	for(int c=0;c<=tempList->size()-1;c++)
		{
			tempList->pop_front();
		}
	delete tempList;

	list=NULL;
	delete[]list;
	delete current;
}
What this function is doing is taking data (linked list) which was read from a file and averaging every 'rate' number of them together. It then adds the average into a new linked list which it passes into the child window to plot on the screen.

Everything runs perfectly fine when I don't include the lines after #*#*#, and I access arrayList in other locations, and it is built/constructed fine since everything else works perfectly.

I almost think it is because I am assigning one instance of the array of linked lists to a single linked list or something, but I don't know whats wrong or how to fix it. Any ideas?

Thanks!!