From 267844abbde819430e0d55da4eec8149a5c01e9c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 10 Jun 2014 16:56:09 +0000 Subject: [PATCH] fix memory leak --- contrib/mobile/drawContext.cpp | 2 ++ contrib/mobile/drawString.cpp | 1 + contrib/mobile/iOS/Onelab/ModelViewController.mm | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/mobile/drawContext.cpp b/contrib/mobile/drawContext.cpp index 549501b404..89778b75dd 100644 --- a/contrib/mobile/drawContext.cpp +++ b/contrib/mobile/drawContext.cpp @@ -62,6 +62,7 @@ void drawContext::load(std::string filename) // restore default options GmshRestoreDefaultOptions(); + GmshSetOption("General", "Terminal", 1.0); // open the file with Gmsh GmshOpenProject(filename); @@ -626,6 +627,7 @@ void drawContext::drawView() checkGlError("Initialize position"); glEnable(GL_DEPTH_TEST); + drawMesh(); checkGlError("Draw mesh"); drawGeom(); diff --git a/contrib/mobile/drawString.cpp b/contrib/mobile/drawString.cpp index 0efdd63422..82169715eb 100644 --- a/contrib/mobile/drawString.cpp +++ b/contrib/mobile/drawString.cpp @@ -10,6 +10,7 @@ drawString::drawString(std::string text, int size, float color[4]) { + _map = 0; _size = size; if(color == NULL) setColor(0.0f, 0.0f, 0.0f, 1.0f); diff --git a/contrib/mobile/iOS/Onelab/ModelViewController.mm b/contrib/mobile/iOS/Onelab/ModelViewController.mm index ebc06dc97e..982406ed8d 100644 --- a/contrib/mobile/iOS/Onelab/ModelViewController.mm +++ b/contrib/mobile/iOS/Onelab/ModelViewController.mm @@ -381,10 +381,11 @@ void getBitmap(void *self, const char *text, int textsize, unsigned char **map, i=2; while(i<*height) i*=2; *height = i; + UIGraphicsBeginImageContextWithOptions(CGSizeMake(*width, *height), NO, 0.0); [lbl.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); - + UIGraphicsEndImageContext(); CGImageRef bitmap = [img CGImage]; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); unsigned char *rawData = (unsigned char*) calloc(*height * *width * 4, sizeof(unsigned char)); -- GitLab