Reworked some fixes submitted to us by ittobaal. Several fclose calls he suggested had no bearing (if fopen fails, calling fclose on a null pointer is pointless), but the (missing) array deletions were definitely valid bugs. The fix for CreateTexture() was a little loose, so I cleaned it up somewhat.
Issue: 566
This commit is contained in:
@@ -53,7 +53,7 @@ JDistortionMesh::~JDistortionMesh()
|
|||||||
{
|
{
|
||||||
|
|
||||||
delete mQuad;
|
delete mQuad;
|
||||||
delete mVertices;
|
delete[] mVertices;
|
||||||
|
|
||||||
// JGERelease();
|
// JGERelease();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ JGBKFont::JGBKFont()
|
|||||||
|
|
||||||
JGBKFont::~JGBKFont()
|
JGBKFont::~JGBKFont()
|
||||||
{
|
{
|
||||||
SAFE_DELETE(mEngFont);
|
SAFE_DELETE_ARRAY(mEngFont);
|
||||||
|
|
||||||
SAFE_DELETE(mChnFont);
|
SAFE_DELETE_ARRAY(mChnFont);
|
||||||
|
|
||||||
SAFE_DELETE(mTexture);
|
SAFE_DELETE(mTexture);
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -800,7 +800,11 @@ void JRenderer::ScreenShot(const char* filename)
|
|||||||
fp = fopen(filename, "wb");
|
fp = fopen(filename, "wb");
|
||||||
if (!fp) return;
|
if (!fp) return;
|
||||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
if (!png_ptr) return;
|
if (!png_ptr)
|
||||||
|
{
|
||||||
|
fclose(fp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
info_ptr = png_create_info_struct(png_ptr);
|
info_ptr = png_create_info_struct(png_ptr);
|
||||||
if (!info_ptr) {
|
if (!info_ptr) {
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
||||||
|
|||||||
+13
-7
@@ -2199,13 +2199,13 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
|
|||||||
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
|
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
|
||||||
{
|
{
|
||||||
checkGlError();
|
checkGlError();
|
||||||
int size = width * height * sizeof(PIXEL_TYPE); // RGBA
|
|
||||||
|
|
||||||
BYTE* buffer = new BYTE[size];
|
|
||||||
|
|
||||||
JTexture *tex = new JTexture();
|
JTexture *tex = new JTexture();
|
||||||
|
|
||||||
if (buffer && tex)
|
if (tex)
|
||||||
|
{
|
||||||
|
int size = width * height * sizeof(PIXEL_TYPE); // RGBA
|
||||||
|
BYTE* buffer = new BYTE[size];
|
||||||
|
if (buffer)
|
||||||
{
|
{
|
||||||
tex->mFilter = TEX_FILTER_LINEAR;
|
tex->mFilter = TEX_FILTER_LINEAR;
|
||||||
tex->mWidth = width;
|
tex->mWidth = width;
|
||||||
@@ -2229,10 +2229,16 @@ JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__
|
|||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
|
|
||||||
checkGlError();
|
checkGlError();
|
||||||
return tex;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return NULL;
|
{
|
||||||
|
delete tex;
|
||||||
|
tex = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user