• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

AE SDK Heap corrupted Exception, with no apparent motivation

New Here ,
May 26, 2020 May 26, 2020

Copy link to clipboard

Copied

I'm developing a plugin that draws a real skymap according to camera.
Now I'm developing a routine that draws thickness antialiased lines. When exiting from this particular routine, AE Crashes. Only when exiting from this routine. 

The debug shows the exception rising point, in the delete_scalar.cpp (library from Microsoft, used in Visual Studio).

Here's My code

PF_Err thickline(int x1, int y1, int x2, int y2, int thickness, PF_EffectWorld *output, PF_Pixel color, AEGP_SuiteHandler& suites )
{
PF_Err err = PF_Err_NONE;
A_long width = output->width;
A_long height = output->height;


PF_Handle startxH = NULL;
startxH = suites.HandleSuite1()->host_new_handle((height+1) * sizeof(int));
void* startxP = suites.HandleSuite1()->host_lock_handle(startxH);
int* startx = reinterpret_cast<int*>(startxP);

PF_Handle endxH = NULL;
endxH = suites.HandleSuite1()->host_new_handle((height+1) * sizeof(int));
void* endxP = suites.HandleSuite1()->host_lock_handle(endxH);
int* endx = reinterpret_cast<int*>(endxP);




for (int i = 0; i < height; i++) startx[i] = endx[i] = -1;

int pointx[5];
int pointy[5];

if (thickness == 1) {
drawline(x1, y1, x2, y2, output, color, 1, true);
return err;
}


Doing some pixels stuff (calculating startx and endx of the scanline for a fillpoly using  four vertices for building a thick line...) 

Then

}

	delete[] pointy;
	delete[] pointx;
		
	suites.HandleSuite1()->host_unlock_handle(endxH);
	suites.HandleSuite1()->host_dispose_handle(endxH);

	suites.HandleSuite1()->host_unlock_handle(startxH);
	suites.HandleSuite1()->host_dispose_handle(startxH);

	err = err;
	return err;
}



When exiting it crashes. 

Sometimes crashes at the first call, sometimes at the second.
I've used the handlesuite as suggested. Previous versione, used new and delete[] but the iussue was the same. Also when no disposing of the arrays was done, the routine crashed when exiting.

I've been debugging this for days.

Any help or suggetsion would be very appreciated. 
Sorry for my english, and thanks.


TOPICS
Crash , SDK

Views

320

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation