1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-01 03:10:06 +00:00

New class: ScopedPointer, which auto-releases a pointer when it goes out of scope. I've used this extensively to replace a lot of pointer deletions with more RAII-style patterns.

This commit is contained in:
Julian Storer 2010-01-02 23:01:18 +00:00
parent 4ed1d791e5
commit c22c06c80c
126 changed files with 1454 additions and 1838 deletions

View file

@ -34,13 +34,11 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
ImagePreviewComponent::ImagePreviewComponent()
: currentThumbnail (0)
{
}
ImagePreviewComponent::~ImagePreviewComponent()
{
delete currentThumbnail;
}
//==============================================================================
@ -70,11 +68,11 @@ void ImagePreviewComponent::timerCallback()
{
stopTimer();
deleteAndZero (currentThumbnail);
currentThumbnail = 0;
currentDetails = String::empty;
repaint();
FileInputStream* const in = fileToLoad.createInputStream();
ScopedPointer <FileInputStream> in (fileToLoad.createInputStream());
if (in != 0)
{
@ -97,14 +95,9 @@ void ImagePreviewComponent::timerCallback()
getThumbSize (w, h);
Image* const reduced = currentThumbnail->createCopy (w, h);
delete currentThumbnail;
currentThumbnail = reduced;
currentThumbnail = currentThumbnail->createCopy (w, h);
}
}
delete in;
}
}