← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2733: fix freezes and other problems with searches within file lists

 

------------------------------------------------------------
revno: 2733
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-12-19 17:31:36 +0100
message:
  fix freezes and other problems with searches within file lists
modified:
  win32/DirectoryListingFrame.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2011-12-18 15:37:20 +0000
+++ win32/DirectoryListingFrame.cpp	2011-12-19 16:31:36 +0000
@@ -1051,7 +1051,9 @@
 	HoldRedraw hold2(dirs);
 	HoldRedraw hold3(status);
 
-	HTREEITEM const start = dirs->getSelected();
+	auto start = dirs->getSelected();
+	if(!start)
+		start = treeRoot;
 
 	auto prevHistory = history;
 	auto prevHistoryIndex = historyIndex;
@@ -1106,18 +1108,18 @@
 		HTREEITEM next = dirs->getNext(item, reverse ? TVGN_PREVIOUSVISIBLE : TVGN_NEXTVISIBLE);
 		if(!next) {
 			next = reverse ? dirs->getLast() : treeRoot;
-			if(!next || next == start) {
-				item = nullptr;
-				break;
-			}
 			cycle = true;
 		}
-		if(reverse && dirs->getChild(next) && !dirs->isExpanded(next)) {
+		while(reverse && dirs->getChild(next) && !dirs->isExpanded(next)) {
 			dirs->expand(next);
 			collapse.push_back(next);
 			if(!(next = dirs->getNext(item, TVGN_PREVIOUSVISIBLE)))
 				next = dirs->getLast();
 		}
+		if(next == start) {
+			item = nullptr;
+			break;
+		}
 
 		// refresh the list pane to respect sorting etc
 		changeDir(dirs->getData(next)->dir);