Hi
I am busy with my 2nd year computer science project, but I have run into some issues. The problems start when I use QFileDialog, as shown below:
".",tr
("DEM Files (*.map *.dem *.bmp);;All Files(*)"),
0,
QFileDialog::DontUseNativeDialog);
QString fileName = QFileDialog::getOpenFileName(parentWidget(), tr("Open File"),
".",tr("DEM Files (*.map *.dem *.bmp);;All Files(*)"),0,QFileDialog::DontUseNativeDialog);
To copy to clipboard, switch view to plain text mode
I get the following message in my Application output window
Lowest section in C:\PROGRA~1\COMMON~1\MICROS~1\OFFICE14\Cultures\OF FICE.ODF is .text at 10001000
Lowest section in C:\PROGRA~1\MICROS~3\Office14\1033\GrooveIntlResou rce.dll is .text at 10001000
I am not to sure if I should worry about this or why it is happening.
the next error I get is:
HEAP[Terrain_Generator.exe]:
Invalid address specified to RtlFreeHeap( 003E0000, 0C1121C8 )
which causes my program to crash. It Happens when I return the stat variable, see code below.
My analysis method that causes the crash
TerrainStats* TerrainAnalyser::analyseTerrain(const HeightMap &map, int sweeps, int radius){
Levels = sweeps;
if (sweeps < 0)
sweeps = -sweeps;
GaussKernel Akern = makeBlurKernel(radius);
HeightMap tmp(map);
HeightMap tmp2(map);
TerrainStats* stats = new TerrainStats(sweeps);
for (int cnt = 0; cnt < sweeps; cnt++){
tmp = GaussianBlur(tmp,Akern);
tmp2 = (tmp2 - tmp);
populateStats(tmp2,stats->levelStats[cnt],cnt);
tmp2 = tmp;
}
return stats; //<- This is what causes the problem
}
TerrainStats* TerrainAnalyser::analyseTerrain(const HeightMap &map, int sweeps, int radius){
Levels = sweeps;
if (sweeps < 0)
sweeps = -sweeps;
GaussKernel Akern = makeBlurKernel(radius);
HeightMap tmp(map);
HeightMap tmp2(map);
TerrainStats* stats = new TerrainStats(sweeps);
for (int cnt = 0; cnt < sweeps; cnt++){
tmp = GaussianBlur(tmp,Akern);
tmp2 = (tmp2 - tmp);
populateStats(tmp2,stats->levelStats[cnt],cnt);
tmp2 = tmp;
}
return stats; //<- This is what causes the problem
}
To copy to clipboard, switch view to plain text mode
I tried a simpler example but it doesn't crash, so it must be something stupid that I am overlooking. I have spent 2 days trying to find it but with no success.
I call the method as follows
TerrainStats *stats = TAnalyser->analyseTerrain((*current),6,32);
populateTable((*stats));
TerrainStats *stats = TAnalyser->analyseTerrain((*current),6,32);
populateTable((*stats));
To copy to clipboard, switch view to plain text mode
Thanks in advance
Bookmarks