mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	fix: Memoryleaks & Coredump, if no Grabber compiled (#724)
* Fix Memoryleaks & Coredump, if no Grabber * Fix Memoryleaks & Coredump, if no Grabber
This commit is contained in:
		| @@ -69,8 +69,11 @@ void ImageProcessor::setSize(const unsigned width, const unsigned height) | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	// Clean up the old buffer and mapping | ||||
| 	_imageToLeds = 0; | ||||
| 	if ( _imageToLeds != nullptr) | ||||
| 	{ | ||||
| 		// Clean up the old buffer and mapping | ||||
| 		delete _imageToLeds; | ||||
| 	} | ||||
|  | ||||
| 	// Construct a new buffer and mapping | ||||
| 	_imageToLeds = (width>0 && height>0) ? (new ImageToLedsMap(width, height, 0, 0, _ledString.leds())) : nullptr; | ||||
| @@ -78,17 +81,20 @@ void ImageProcessor::setSize(const unsigned width, const unsigned height) | ||||
|  | ||||
| void ImageProcessor::setLedString(const LedString& ledString) | ||||
| { | ||||
| 	_ledString = ledString; | ||||
| 	if ( _imageToLeds != nullptr) | ||||
| 	{ | ||||
| 		_ledString = ledString; | ||||
|  | ||||
| 	// get current width/height | ||||
| 	const unsigned width = _imageToLeds->width(); | ||||
| 	const unsigned height = _imageToLeds->height(); | ||||
| 		// get current width/height | ||||
| 		unsigned width = _imageToLeds->width(); | ||||
| 		unsigned height = _imageToLeds->height(); | ||||
|  | ||||
| 	// Clean up the old buffer and mapping | ||||
| 	_imageToLeds = 0; | ||||
| 		// Clean up the old buffer and mapping | ||||
| 		delete _imageToLeds; | ||||
|  | ||||
| 	// Construct a new buffer and mapping | ||||
| 	_imageToLeds = new ImageToLedsMap(width, height, 0, 0, _ledString.leds()); | ||||
| 		// Construct a new buffer and mapping | ||||
| 		_imageToLeds = new ImageToLedsMap(width, height, 0, 0, _ledString.leds()); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void ImageProcessor::setBlackbarDetectDisable(bool enable) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user