Fixed thumbnail delete ordering issues (also found ffsup2).

Fixed minor memory leak found by valgrind.

Fixed thumbnail processing ordering issue.
This commit is contained in:
Steve Herrell
2010-11-15 20:56:26 -05:00
parent a9cd01f992
commit a9a8141b20
5 changed files with 20 additions and 8 deletions

View File

@@ -98,6 +98,9 @@ Thumbnail* Thumbnail::loadFromMemory (const char* image, int length, int &w, int
}
tpp->thumbImg = img->resize (w, h, TI_Nearest);
tpp->autowbTemp=2700;
tpp->autowbGreen=1.0;
delete img;
tpp->init ();

View File

@@ -249,7 +249,6 @@ void FileBrowser::close () {
for (int i=0; i<fd.size(); i++)
{
((FileBrowserEntry*)fd[i])->thumbnail->decreaseRef ();
delete fd[i];
}
fd.clear ();

View File

@@ -48,6 +48,7 @@ FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname)
editedIcon = safe_create_from_file (argv0+"/images/edited.png");
recentlySavedIcon = safe_create_from_file (argv0+"/images/saved.png");
enqueuedIcon = safe_create_from_file (argv0+"/images/processing.png");
iconsLoaded = true;
}
if (thm)
@@ -68,8 +69,10 @@ FileBrowserEntry::~FileBrowserEntry () {
}
thumbImageUpdater->removeJobs (this);
if (thumbnail)
if (thumbnail){
thumbnail->removeThumbnailListener (this);
thumbnail->decreaseRef ();
}
}
void FileBrowserEntry::refreshThumbnailImage () {
@@ -186,6 +189,7 @@ void FileBrowserEntry::updateImage (rtengine::IImage8* img, double scale, rtengi
if ( feih == 0 ||
feih->destroyed )
{
img->free();
return;
}

View File

@@ -97,7 +97,7 @@ public:
// nothing to do; could be jobs have been removed
if ( jobs_.empty() )
{
DEBUG("processing: nothing to do (%d,%d)",paused_,jobs_.empty());
DEBUG("processing: nothing to do (%d)",jobs_.empty());
return;
}
@@ -114,6 +114,8 @@ public:
}
// see if any none upgrade jobs exist
if ( i == jobs_.end() )
{
for ( i = jobs_.begin(); i != jobs_.end(); ++i)
{
if ( !i->upgrade_ )
@@ -122,6 +124,7 @@ public:
break;
}
}
}
// if none, then use first
if ( i == jobs_.end() )

View File

@@ -489,13 +489,16 @@ void Thumbnail::setFileName (const Glib::ustring fn) {
void Thumbnail::addThumbnailListener (ThumbnailListener* tnl) {
increaseRef();
listeners.push_back (tnl);
}
void Thumbnail::removeThumbnailListener (ThumbnailListener* tnl) {
std::vector<ThumbnailListener*>::iterator f = std::find (listeners.begin(), listeners.end(), tnl);
if (f!=listeners.end())
if (f!=listeners.end()) {
listeners.erase (f);
decreaseRef();
}
}