Solving issue 1936: "Using the File Browser's filters freeze RT"

This commit is contained in:
natureh 510
2013-07-29 23:29:02 +02:00
parent 4c35ea83d0
commit 50be5a17d9
3 changed files with 11 additions and 8 deletions

View File

@@ -463,7 +463,7 @@ void FileCatalog::closeDir () {
fileNameList.clear (); fileNameList.clear ();
{ {
Glib::Mutex::Lock lock(filterMutex); Glib::Mutex::Lock lock(dirEFSMutex);
dirEFS.clear (); dirEFS.clear ();
} }
hasValidCurrentEFS = false; hasValidCurrentEFS = false;
@@ -588,7 +588,7 @@ void FileCatalog::previewReady (int dir_id, FileBrowserEntry* fdn) {
const CacheImageData* cfs = fdn->thumbnail->getCacheImageData(); const CacheImageData* cfs = fdn->thumbnail->getCacheImageData();
{ {
Glib::Mutex::Lock lock(filterMutex); Glib::Mutex::Lock lock(dirEFSMutex);
if (cfs->exifValid) { if (cfs->exifValid) {
if (cfs->fnumber < dirEFS.fnumberFrom) if (cfs->fnumber < dirEFS.fnumberFrom)
dirEFS.fnumberFrom = cfs->fnumber; dirEFS.fnumberFrom = cfs->fnumber;
@@ -633,8 +633,8 @@ void FileCatalog::previewsFinishedUI () {
if (filterPanel) { if (filterPanel) {
filterPanel->set_sensitive (true); filterPanel->set_sensitive (true);
Glib::Mutex::Lock lock(filterMutex);
if ( !hasValidCurrentEFS ){ if ( !hasValidCurrentEFS ){
Glib::Mutex::Lock lock(dirEFSMutex);
currentEFS = dirEFS; currentEFS = dirEFS;
filterPanel->setFilter ( dirEFS,true ); filterPanel->setFilter ( dirEFS,true );
}else { }else {
@@ -672,7 +672,7 @@ void FileCatalog::previewsFinished (int dir_id) {
} }
if (!hasValidCurrentEFS) { if (!hasValidCurrentEFS) {
Glib::Mutex::Lock lock(filterMutex); Glib::Mutex::Lock lock(dirEFSMutex);
currentEFS = dirEFS; currentEFS = dirEFS;
} }
@@ -1321,8 +1321,8 @@ BrowserFilter FileCatalog::getFilter () {
if (!filterPanel) if (!filterPanel)
filter.exifFilterEnabled = false; filter.exifFilterEnabled = false;
else { else {
Glib::Mutex::Lock lock(filterMutex);
if (!hasValidCurrentEFS) { if (!hasValidCurrentEFS) {
Glib::Mutex::Lock lock(dirEFSMutex);
filter.exifFilter = dirEFS; filter.exifFilter = dirEFS;
} }
else else
@@ -1507,10 +1507,9 @@ void FileCatalog::selectionChanged (std::vector<Thumbnail*> tbe) {
fslistener->selectionChanged (tbe); fslistener->selectionChanged (tbe);
} }
// Called within GTK UI thread
void FileCatalog::exifFilterChanged () { void FileCatalog::exifFilterChanged () {
// not sure that locking is necessary here...
Glib::Mutex::Lock lock(filterMutex);
currentEFS = filterPanel->getFilter (); currentEFS = filterPanel->getFilter ();
hasValidCurrentEFS = true; hasValidCurrentEFS = true;
fileBrowser->applyFilter (getFilter ()); fileBrowser->applyFilter (getFilter ());
@@ -1531,11 +1530,14 @@ void FileCatalog::trashChanged () {
bTrash->set_image(*iTrashFull); bTrash->set_image(*iTrashFull);
} }
} }
// Called within GTK UI thread
void FileCatalog::buttonQueryClearPressed () { void FileCatalog::buttonQueryClearPressed () {
Query->set_text(""); Query->set_text("");
FileCatalog::executeQuery (); FileCatalog::executeQuery ();
} }
// Called within GTK UI thread
void FileCatalog::executeQuery(){ void FileCatalog::executeQuery(){
// if BrowsePath text was changed, do a full browse; // if BrowsePath text was changed, do a full browse;
// otherwise filter only // otherwise filter only

View File

@@ -133,7 +133,7 @@ class FileCatalog : public Gtk::VBox,
Gtk::Button* zoomInButton; Gtk::Button* zoomInButton;
Gtk::Button* zoomOutButton; Gtk::Button* zoomOutButton;
Glib::Mutex filterMutex; Glib::Mutex dirEFSMutex;
ExifFilterSettings dirEFS; ExifFilterSettings dirEFS;
ExifFilterSettings currentEFS; ExifFilterSettings currentEFS;
bool hasValidCurrentEFS; bool hasValidCurrentEFS;

View File

@@ -322,6 +322,7 @@ ExifFilterSettings FilterPanel::getFilter () {
return efs; return efs;
} }
// Called within GTK UI thread
void FilterPanel::valueChanged () { void FilterPanel::valueChanged () {
if (listener) if (listener)