diff --git a/rtengine/bilateral3.h b/rtengine/bilateral3.h index 61b58606f..3eaab7e4f 100644 --- a/rtengine/bilateral3.h +++ b/rtengine/bilateral3.h @@ -400,7 +400,7 @@ template void bilateral (T** src, int** dst, int W, int H, int sigmar, // exponential lookup table int scale = (2.0*sigmar*sigmar) / scaleg; int scalem = 65535/((1+2*r)*(1+2*r)); - int ec[256000]; + int *ec = new int[256000]; for (int i=0; i<256000; i++) ec[i] = exp (-i/scaleg) * scalem; @@ -425,6 +425,7 @@ template void bilateral (T** src, int** dst, int W, int H, int sigmar, } } delete [] kernel; + delete [] ec; time_t t2 = clock (); printf ("bilateral: %d\n", t2-t1); diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 5224a9606..3088ea415 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -956,17 +956,21 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou } - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -int CurveFactory::gammatab [65536]; -int CurveFactory::igammatab_srgb [65536]; -int CurveFactory::gammatab_srgb [65536]; + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +int *CurveFactory::gammatab = 0; +int *CurveFactory::igammatab_srgb = 0; +int *CurveFactory::gammatab_srgb = 0; void CurveFactory::init () { + gammatab = new int[65536]; + igammatab_srgb = new int[65536]; + gammatab_srgb = new int[65536]; + for (int i=0; i<65536; i++) gammatab_srgb[i] = (int)(65535 * gamma2 (i/65535.0)); for (int i=0; i<65536; i++) @@ -980,5 +984,11 @@ void CurveFactory::init () { fclose (f);*/ } +void CurveFactory::cleanup () { + + delete [] gammatab; + delete [] igammatab_srgb; + delete [] gammatab_srgb; } +} diff --git a/rtengine/curves.h b/rtengine/curves.h index c0290a7a9..49624f8ea 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -38,11 +38,11 @@ class CurveFactory { protected: // look-up tables for the standard srgb gamma and its inverse (filled by init()) - static int igammatab_srgb[65536]; - static int gammatab_srgb[65536]; + static int *igammatab_srgb; + static int *gammatab_srgb; // look-up tables for the simple exponential gamma - static int gammatab[65536]; - + static int *gammatab; + // functions calculating the parameters of the contrast curve based on the desired slope at the center static double solve_upper (double m, double c, double deriv); static double solve_lower (double m, double c, double deriv); @@ -135,6 +135,7 @@ class CurveFactory { public: static void init (); + static void cleanup (); static inline double centercontrast (double x, double b, double m); diff --git a/rtengine/dirpyrLab_denoise.cc b/rtengine/dirpyrLab_denoise.cc index a1bc88bcf..247adf6ca 100644 --- a/rtengine/dirpyrLab_denoise.cc +++ b/rtengine/dirpyrLab_denoise.cc @@ -100,7 +100,7 @@ namespace rtengine { //float gam = 2.0;//MIN(3.0, 0.1*fabs(c[4])/3.0+0.001); float gamthresh = 0.03; float gamslope = exp(log((double)gamthresh)/gam)/gamthresh; - unsigned short gamcurve[65536]; + unsigned short * gamcurve = new unsigned short [65536]; for (int i=0; i<65536; i++) { int g = (int)(CurveFactory::gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0) * 65535.0); //if (i<500) printf("%d %d \n",i,g); @@ -261,6 +261,7 @@ namespace rtengine { delete [] rangefn_ab; delete [] nrwt_l; delete [] nrwt_ab; + delete [] gamcurve; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% }; diff --git a/rtengine/dirpyrLab_equalizer.cc b/rtengine/dirpyrLab_equalizer.cc index 03828fa1d..5a4a60dfe 100644 --- a/rtengine/dirpyrLab_equalizer.cc +++ b/rtengine/dirpyrLab_equalizer.cc @@ -82,7 +82,7 @@ namespace rtengine { /*float gam = 2.0;//MIN(3.0, 0.1*fabs(c[4])/3.0+0.001); float gamthresh = 0.03; float gamslope = exp(log((double)gamthresh)/gam)/gamthresh; - unsigned short gamcurve[65536]; + unsigned short * gamcurve = new unsigned short [65536]; for (int i=0; i<65536; i++) { int g = (int)(CurveFactory::gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0) * 65535.0); //if (i<500) printf("%d %d \n",i,g); @@ -266,6 +266,7 @@ namespace rtengine { //delete [] rangefn_L; //delete [] rangefn_ab; delete [] rangefn; + //delete [] gamcurve; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/rtengine/dirpyr_equalizer.cc b/rtengine/dirpyr_equalizer.cc index 6c6cb82bc..5be00ffb0 100644 --- a/rtengine/dirpyr_equalizer.cc +++ b/rtengine/dirpyr_equalizer.cc @@ -66,7 +66,7 @@ namespace rtengine { /*float gam = 2.0;//MIN(3.0, 0.1*fabs(c[4])/3.0+0.001); float gamthresh = 0.03; float gamslope = exp(log((double)gamthresh)/gam)/gamthresh; - unsigned short gamcurve[65536]; + unsigned short *gamcurve = new unsigned short[65536]; for (int i=0; i<65536; i++) { int g = (int)(CurveFactory::gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0) * 65535.0); //if (i<500) printf("%d %d \n",i,g); @@ -191,6 +191,7 @@ namespace rtengine { freeArray(buffer, srcheight); delete [] rangefn; + //delete [] gamcurve; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/rtengine/fast_demo.cc b/rtengine/fast_demo.cc index 5396fea07..a81494141 100644 --- a/rtengine/fast_demo.cc +++ b/rtengine/fast_demo.cc @@ -25,15 +25,21 @@ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -static float dirwt[0x10000]; +static float *dirwt; static void __attribute__((constructor)) setup_dirwt() { + dirwt = new float[0x10000]; //set up directional weight function for (int i=0; i<0x10000; i++) dirwt[i] = 1.0/SQR(1.0+i); } +static void __attribute__((destructor)) cleanup_dirwt() +{ + delete [] dirwt; +} + void RawImageSource::fast_demo(int winx, int winy, int winw, int winh) { //int winx=0, winy=0; //int winw=W, winh=H; diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 533363fc1..61b366778 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -621,7 +621,7 @@ int ImageIO::saveJPEG (Glib::ustring fname, int quality) { jpeg_start_compress(&cinfo, TRUE); // buffer for exif and iptc markers - unsigned char buffer[165535]; + unsigned char* buffer = new unsigned char[165535]; //TODO: Is it really 165535... or 65535 ? unsigned int size; // assemble and write exif marker if (exifRoot) { @@ -674,6 +674,8 @@ int ImageIO::saveJPEG (Glib::ustring fname, int quality) { jpeg_destroy_compress (&cinfo); delete [] row; + delete [] buffer; + fclose (file); if (pl) { @@ -707,7 +709,7 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed) { } // buffer for the exif and iptc - unsigned char buffer[165535]; + unsigned char* buffer = new unsigned char[165535]; //TODO: Is it really 165535... or 65535 ? unsigned char* iptcdata = NULL; unsigned int iptclen = 0; if (iptc && iptc_data_save (iptc, &iptcdata, &iptclen) && iptcdata) { @@ -717,6 +719,9 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed) { int size = rtexif::ExifManager::createTIFFHeader (exifRoot, exifChange, width, height, bps, profileData, profileLength, (char*)iptcdata, iptclen, buffer); if (iptcdata) iptc_data_free_buf (iptc, iptcdata); + + // The maximum lenght is strangely not the same than for the JPEG file... + // Which maximum length is the good one ? if (size>0 && size<165530) fwrite (buffer, size, 1, file); @@ -734,6 +739,7 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed) { if (pl && !(i%100)) pl->setProgress ((double)(i+1)/height); } + delete [] buffer; fclose (file); } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 42b91bad2..82b0a6bbc 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -30,9 +30,31 @@ extern Settings* settings; ImProcCoordinator::ImProcCoordinator () : awbComputed(false), ipf(¶ms, true), scale(10), allocated(false), - pW(-1), pH(-1), plistener(NULL), imageListener(NULL),fineDetailsProcessed(false), - aeListener(NULL), hListener(NULL), resultValid(false), + pW(-1), pH(-1), plistener(NULL),fineDetailsProcessed(false), + imageListener(NULL), aeListener(NULL), hListener(NULL), resultValid(false), changeSinceLast(0), updaterRunning(false), destroying(false) { + + dummy1 = new float[65536]; + dummy2 = new float[65536]; + hltonecurve = new float[65536]; + shtonecurve = new float[65536]; + tonecurve = new int[65536]; + + lumacurve = new int[65536]; + chroma_acurve = new int[65536]; + chroma_bcurve = new int[65536]; + + vhist16 = new unsigned int[65536]; + lhist16 = new unsigned int[65536]; + + rhist = new unsigned int[256]; + ghist = new unsigned int[256]; + bhist = new unsigned int[256]; + Lhist = new unsigned int[256]; + bcrgbhist = new unsigned int[256]; + bcLhist = new unsigned int[256]; + bcabhist = new unsigned int[256]; + } void ImProcCoordinator::assign (ImageSource* imgsrc) { @@ -53,6 +75,27 @@ ImProcCoordinator::~ImProcCoordinator () { for (int i=0; idecreaseRef (); updaterThreadStart.unlock (); } @@ -149,11 +192,12 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { if (todo & M_AUTOEXP) { if (params.toneCurve.autoexp) { - unsigned int aehist[65536]; int aehistcompr; + unsigned int *aehist = new unsigned int[65536]; int aehistcompr; imgsrc->getAEHistogram (aehist, aehistcompr); ipf.getAutoExp (aehist, aehistcompr, imgsrc->getDefGain(), params.toneCurve.clip, params.toneCurve.expcomp, params.toneCurve.black); if (aeListener) aeListener->autoExpChanged (params.toneCurve.expcomp, params.toneCurve.black); + delete [] aehist; } } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 72bc17ac9..041783440 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -62,20 +62,20 @@ class ImProcCoordinator : public StagedImageProcessor { void freeAll (); - float dummy1 [65536]; - float dummy2 [65536]; - float hltonecurve [65536]; - float shtonecurve [65536]; - int tonecurve [65536]; + float *dummy1; + float *dummy2; + float *hltonecurve; + float *shtonecurve; + int *tonecurve; - int lumacurve [65536]; - int chroma_acurve [65536]; - int chroma_bcurve [65536]; + int *lumacurve; + int *chroma_acurve; + int *chroma_bcurve; - unsigned int vhist16[65536]; - unsigned int lhist16[65536]; + unsigned int *vhist16; + unsigned int *lhist16; - unsigned int rhist[256], ghist[256], bhist[256], Lhist[256], bcrgbhist[256], bcLhist[256], bcabhist[256]; + unsigned int *rhist, *ghist, *bhist, *Lhist, *bcrgbhist, *bcLhist, *bcabhist; int fw, fh, tr, fullw, fullh; int pW, pH; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 9de1a368b..8d5d2d638 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -61,20 +61,21 @@ using namespace procparams; extern const Settings* settings; -int* ImProcFunctions::cacheL; -int* ImProcFunctions::cachea; -int* ImProcFunctions::cacheb; -int* ImProcFunctions::xcache; -int* ImProcFunctions::ycache; -int* ImProcFunctions::zcache; -unsigned short ImProcFunctions::gamma2curve[65536]; +int* ImProcFunctions::cacheL = 0; +int* ImProcFunctions::cachea = 0; +int* ImProcFunctions::cacheb = 0; +int* ImProcFunctions::xcache = 0; +int* ImProcFunctions::ycache = 0; +int* ImProcFunctions::zcache = 0; +unsigned short* ImProcFunctions::gamma2curve = 0; void ImProcFunctions::initCache () { - int maxindex = 2*65536; + const int maxindex = 2*65536; cacheL = new int[maxindex]; cachea = new int[maxindex]; cacheb = new int[maxindex]; + gamma2curve = new unsigned short[65536]; int threshold = (int)(0.008856*CMAXVAL); for (int i=0; i #include #include +#include namespace rtengine { @@ -36,12 +37,20 @@ int init (const Settings* s) { iccStore->parseDir (s->iccDirectory); CurveFactory::init (); ImProcFunctions::initCache (); + Thumbnail::initGamma (); delete lcmsMutex; lcmsMutex = new Glib::Mutex; dfm.init( s->darkFramesPath ); return 0; } +void cleanup () { + + CurveFactory::cleanup (); + ImProcFunctions::cleanupCache (); + Thumbnail::cleanupGamma (); +} + StagedImageProcessor* StagedImageProcessor::create (InitialImage* initialImage) { ImProcCoordinator* ipc = new ImProcCoordinator (); diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index d1d640d0b..7f1668795 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -72,7 +72,7 @@ class RawImageSource : public ImageSource { int max[3]; double initialGain; // initial gain calculated after scale_colors double defGain; - int blcode[16][16][32]; + //int blcode[16][16][32]; // Looks like it's an unused variable... bool full; cmsHPROFILE camProfile; cmsHPROFILE embProfile; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index af3214b5d..17b7a5537 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -304,6 +304,9 @@ namespace rtengine { * @param s is a struct of basic settings */ int init (const Settings* s); +/** Cleanup the RT engine (static variables) */ + void cleanup (); + /** Returns the available output profile names * @return a vector of the available output profile names */ std::vector getOutputProfiles (); diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 7a221ec82..c096782b3 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -484,6 +484,23 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati #undef FISBLUE +unsigned short *Thumbnail::igammatab = 0; +unsigned char *Thumbnail::gammatab = 0; + +void Thumbnail::initGamma () { + igammatab = new unsigned short[256]; + gammatab = new unsigned char[65536]; + for (int i=0; i<256; i++) + igammatab[i] = (unsigned short)(255.0*pow((double)i/255.0,1.0/0.45)); + for (int i=0; i<65536; i++) + gammatab[i] = (unsigned char)(255.0*pow((double)i/65535.0,0.45)); +} + +void Thumbnail::cleanupGamma () { + delete [] igammatab; + delete [] gammatab; +} + void Thumbnail::init () { RawImageSource::inverse33 (colorMatrix, iColorMatrix); @@ -495,20 +512,8 @@ void Thumbnail::init () { camProfile = iccStore->createFromMatrix (camToD50, false, "Camera"); } -bool Thumbnail::igammacomputed = false; -unsigned short Thumbnail::igammatab[256]; -unsigned char Thumbnail::gammatab[65536]; - Thumbnail::Thumbnail () : camProfile(NULL), thumbImg(NULL), aeHistogram(NULL), embProfileData(NULL), embProfile(NULL) { - - if (!igammacomputed) { - for (int i=0; i<256; i++) - igammatab[i] = (unsigned short)(255.0*pow(i/255.0,1.0/0.45)); - for (int i=0; i<65536; i++) - gammatab[i] = (unsigned char)(255.0*pow(i/65535.0,0.45)); - igammacomputed = true; - } } Thumbnail::~Thumbnail () { diff --git a/rtengine/rtthumbnail.h b/rtengine/rtthumbnail.h index 9a93acc48..64c95098f 100644 --- a/rtengine/rtthumbnail.h +++ b/rtengine/rtthumbnail.h @@ -36,9 +36,8 @@ namespace rtengine { void transformPixel (int x, int y, int tran, int& tx, int& ty); - static bool igammacomputed; - static unsigned short igammatab[256]; - static unsigned char gammatab[65536]; + static unsigned short *igammatab; + static unsigned char *gammatab; Image16* thumbImg; double camwbRed; @@ -67,6 +66,8 @@ namespace rtengine { ~Thumbnail (); Thumbnail (); + static void initGamma (); + static void cleanupGamma (); void init (); IImage8* processImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index c1fd6abf8..3428acc9f 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -46,7 +46,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (!ii) { ii = InitialImage::load (job->fname, job->isRaw, &errorCode); if (errorCode) { - ii->decreaseRef (); delete job; return NULL; } @@ -135,9 +134,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p int bl = params.toneCurve.black; if (params.toneCurve.autoexp) { - unsigned int aehist[65536]; int aehistcompr; + unsigned int* aehist = new unsigned int [65536]; int aehistcompr; imgsrc->getAEHistogram (aehist, aehistcompr); ipf.getAutoExp (aehist, aehistcompr, imgsrc->getDefGain(), params.toneCurve.clip, br, bl); + delete [] aehist; } float* curve1 = new float [65536]; diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index c89505b3f..f70f9e0f7 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -112,9 +112,9 @@ bool BatchQueue::loadBatchQueue( ) if (f==NULL) return false; - char buffer[1024]; + char *buffer = new char[1024]; unsigned numLoaded=0; - while (fgets (buffer, sizeof(buffer), f)){ + while (fgets (buffer, 1024, f)){ char *p = strchr(buffer,';' ); if( p ){ char *le = buffer + strlen(buffer); @@ -156,6 +156,7 @@ bool BatchQueue::loadBatchQueue( ) } } } + delete [] buffer; fclose(f); arrangeFiles (); queue_draw (); diff --git a/rtgui/curveeditor.cc b/rtgui/curveeditor.cc index 2ea495a37..6d584e2fb 100644 --- a/rtgui/curveeditor.cc +++ b/rtgui/curveeditor.cc @@ -37,6 +37,8 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup) { bgHistValid = false; selected = Linear; + histogram = new unsigned int[256]; // histogram values + group = ceGroup; if (group && text.size()) @@ -58,11 +60,11 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup) { curveType->show(); } -/* CurveEditor::~CurveEditor () { + delete [] histogram; } -*/ + void CurveEditor::setCurve (const std::vector& p) { tempCurve = p; diff --git a/rtgui/curveeditor.h b/rtgui/curveeditor.h index fe8944912..6f0ef6e9a 100644 --- a/rtgui/curveeditor.h +++ b/rtgui/curveeditor.h @@ -43,7 +43,7 @@ private: CurveType selected; PopUpToggleButton* curveType; - unsigned int histogram[256]; // histogram values + unsigned int* histogram; // histogram values bool bgHistValid; CurveEditorGroup* group; @@ -57,7 +57,7 @@ public: friend class CurveEditorGroup; CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup); - //~CurveEditor (); + ~CurveEditor (); void typeSelectionChanged (int n); void curveTypeToggled(); void setCurve (const std::vector& p); diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 1adaec9e7..e79b87514 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -77,6 +77,11 @@ void HistogramPanel::rgbv_toggled () { HistogramArea::HistogramArea () : valid(false), showFull(true), oldwidth(-1), needVal(true), needRed(true), needGreen(true), needBlue(true) { + lhist = new unsigned int[256]; + rhist = new unsigned int[256]; + ghist = new unsigned int[256]; + bhist = new unsigned int[256]; + haih = new HistogramAreaIdleHelper; haih->harea = this; haih->destroyed = false; @@ -91,6 +96,11 @@ HistogramArea::~HistogramArea () { haih->destroyed = true; else delete haih; + + delete [] lhist; + delete [] rhist; + delete [] ghist; + delete [] bhist; } void HistogramArea::updateOptions (bool r, bool g, bool b, bool v) { diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index 0da1edcd4..43d96928f 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -44,10 +44,10 @@ class HistogramArea : public Gtk::DrawingArea { Gdk::Color lgray; Gdk::Color mgray; Gdk::Color dgray; - unsigned int lhist[256]; - unsigned int rhist[256]; - unsigned int ghist[256]; - unsigned int bhist[256]; + unsigned int* lhist; + unsigned int* rhist; + unsigned int* ghist; + unsigned int* bhist; bool valid; bool showFull; int oldwidth, oldheight; diff --git a/rtgui/main.cc b/rtgui/main.cc index 93661eb68..accd40dbf 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -57,7 +57,7 @@ int main(int argc, char **argv) std::string argv0_, argv1_; #ifdef WIN32 - char exname[512]; + char *exname = new char[512]; GetModuleFileName (NULL, exname, 512); argv0_ = exname; // get the path where the rawtherapee is stored @@ -124,6 +124,8 @@ int main(int argc, char **argv) m.run(*rtWindow); gdk_threads_leave (); delete rtWindow; + rtengine::cleanup(); + delete [] exname; return 0; } diff --git a/rtgui/mycurve.cc b/rtgui/mycurve.cc index 6805a9230..60fa20813 100644 --- a/rtgui/mycurve.cc +++ b/rtgui/mycurve.cc @@ -32,6 +32,8 @@ MyCurve::MyCurve () : listener(NULL), activeParam(-1), bghistvalid(false) { lit_point = -1; buttonPressed = false; + bghist = new unsigned int[256]; + set_extension_events(Gdk::EXTENSION_EVENTS_ALL); add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK); signal_event().connect( sigc::mem_fun(*this, &MyCurve::handleEvents) ); @@ -54,8 +56,8 @@ MyCurve::~MyCurve () { mcih->destroyed = true; else delete mcih; - //curve.x.clear(); - //curve.y.clear(); + + delete [] bghist; } std::vector MyCurve::get_vector (int veclen) { diff --git a/rtgui/mycurve.h b/rtgui/mycurve.h index 21b2b8b12..1cd07adc4 100644 --- a/rtgui/mycurve.h +++ b/rtgui/mycurve.h @@ -84,7 +84,7 @@ class MyCurve : public Gtk::DrawingArea { std::vector upoint; std::vector lpoint; int activeParam; - unsigned int bghist[256]; // histogram values + unsigned int* bghist; // histogram values bool bghistvalid; bool buttonPressed; MyCurveIdleHelper* mcih;