Patch from Issue 2406 revoked

This commit is contained in:
Ingo
2014-09-09 15:56:13 +02:00
parent ef4b316745
commit ee7bb48aac
2 changed files with 12 additions and 8 deletions

View File

@@ -475,7 +475,7 @@ std::vector<Glib::ustring> FileCatalog::getFileList () {
std::vector<Glib::ustring> names; std::vector<Glib::ustring> names;
Glib::RefPtr<Gio::File> dir = Gio::File::create_for_path (selectedDirectory); Glib::RefPtr<Gio::File> dir = Gio::File::create_for_path (selectedDirectory);
safe_build_file_list (dir, names, selectedDirectory, &(options.parsedExtensions)); safe_build_file_list (dir, names, selectedDirectory, &(options.parsedExtensions));
std::sort (names.begin(), names.end()); // Issue 2406 std::sort (names.begin(), names.end());
return names; return names;
} }

View File

@@ -50,6 +50,7 @@ public:
Glib::ustring dir_entry_; Glib::ustring dir_entry_;
PreviewLoaderListener* listener_; PreviewLoaderListener* listener_;
}; };
/* Issue 2406
struct OutputJob struct OutputJob
{ {
bool complete; bool complete;
@@ -57,7 +58,7 @@ public:
PreviewLoaderListener* listener; PreviewLoaderListener* listener;
FileBrowserEntry* fdn; FileBrowserEntry* fdn;
}; };
*/
struct JobCompare struct JobCompare
{ {
bool operator()(const Job& lhs, const Job& rhs) bool operator()(const Job& lhs, const Job& rhs)
@@ -86,12 +87,12 @@ public:
MyMutex mutex_; MyMutex mutex_;
JobSet jobs_; JobSet jobs_;
gint nConcurrentThreads; gint nConcurrentThreads;
std::vector<OutputJob *> output_; // Issue 2406 std::vector<OutputJob *> output_;
void processNextJob() void processNextJob()
{ {
Job j; Job j;
OutputJob *oj; // Issue 2406 OutputJob *oj;
{ {
MyMutex::MyLock lock(mutex_); MyMutex::MyLock lock(mutex_);
@@ -107,19 +108,21 @@ public:
jobs_.erase(jobs_.begin()); jobs_.erase(jobs_.begin());
DEBUG("processing %s",j.dir_entry_.c_str()); DEBUG("processing %s",j.dir_entry_.c_str());
DEBUG("%d job(s) remaining",jobs_.size()); DEBUG("%d job(s) remaining",jobs_.size());
/* Issue 2406
oj = new OutputJob(); oj = new OutputJob();
oj->complete = false; oj->complete = false;
oj->dir_id = j.dir_id_; oj->dir_id = j.dir_id_;
oj->listener = j.listener_; oj->listener = j.listener_;
oj->fdn = 0; oj->fdn = 0;
output_.push_back(oj); output_.push_back(oj);
*/
} }
g_atomic_int_inc (&nConcurrentThreads); // to detect when last thread in pool has run out g_atomic_int_inc (&nConcurrentThreads); // to detect when last thread in pool has run out
// unlock and do processing; will relock on block exit, then call listener // unlock and do processing; will relock on block exit, then call listener
// if something got // if something got
FileBrowserEntry* fdn = 0; // Issue 2406 FileBrowserEntry* fdn = 0;
try { try {
Thumbnail* tmb = 0; Thumbnail* tmb = 0;
{ {
@@ -130,11 +133,12 @@ public:
} }
if ( tmb ) if ( tmb )
{ {
fdn = new FileBrowserEntry(tmb,j.dir_entry_); j.listener_->previewReady(j.dir_id_,new FileBrowserEntry(tmb,j.dir_entry_));
// Issue 2406 fdn = new FileBrowserEntry(tmb,j.dir_entry_);
} }
} catch (Glib::Error &e){} catch(...){} } catch (Glib::Error &e){} catch(...){}
/* Issue 2406
{ {
// the purpose of the output_ vector is to deliver the previewReady() calls in the same // the purpose of the output_ vector is to deliver the previewReady() calls in the same
// order as we got the jobs from the jobs_ queue. // order as we got the jobs from the jobs_ queue.
@@ -150,7 +154,7 @@ public:
delete oj; delete oj;
} }
} }
*/
bool last = g_atomic_int_dec_and_test (&nConcurrentThreads); bool last = g_atomic_int_dec_and_test (&nConcurrentThreads);
// signal at end // signal at end