Skip to content
Snippets Groups Projects
Commit 267844ab authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix memory leak

parent 1e020f4c
No related branches found
No related tags found
No related merge requests found
...@@ -62,6 +62,7 @@ void drawContext::load(std::string filename) ...@@ -62,6 +62,7 @@ void drawContext::load(std::string filename)
// restore default options // restore default options
GmshRestoreDefaultOptions(); GmshRestoreDefaultOptions();
GmshSetOption("General", "Terminal", 1.0);
// open the file with Gmsh // open the file with Gmsh
GmshOpenProject(filename); GmshOpenProject(filename);
...@@ -626,6 +627,7 @@ void drawContext::drawView() ...@@ -626,6 +627,7 @@ void drawContext::drawView()
checkGlError("Initialize position"); checkGlError("Initialize position");
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
drawMesh(); drawMesh();
checkGlError("Draw mesh"); checkGlError("Draw mesh");
drawGeom(); drawGeom();
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
drawString::drawString(std::string text, int size, float color[4]) drawString::drawString(std::string text, int size, float color[4])
{ {
_map = 0;
_size = size; _size = size;
if(color == NULL) if(color == NULL)
setColor(0.0f, 0.0f, 0.0f, 1.0f); setColor(0.0f, 0.0f, 0.0f, 1.0f);
......
...@@ -381,10 +381,11 @@ void getBitmap(void *self, const char *text, int textsize, unsigned char **map, ...@@ -381,10 +381,11 @@ void getBitmap(void *self, const char *text, int textsize, unsigned char **map,
i=2; i=2;
while(i<*height) i*=2; while(i<*height) i*=2;
*height = i; *height = i;
UIGraphicsBeginImageContextWithOptions(CGSizeMake(*width, *height), NO, 0.0); UIGraphicsBeginImageContextWithOptions(CGSizeMake(*width, *height), NO, 0.0);
[lbl.layer renderInContext:UIGraphicsGetCurrentContext()]; [lbl.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGImageRef bitmap = [img CGImage]; CGImageRef bitmap = [img CGImage];
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
unsigned char *rawData = (unsigned char*) calloc(*height * *width * 4, sizeof(unsigned char)); unsigned char *rawData = (unsigned char*) calloc(*height * *width * 4, sizeof(unsigned char));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment