← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3321: Fix collateral row deletions in transfers & searches

 

------------------------------------------------------------
revno: 3321
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2013-07-05 23:25:29 +0200
message:
  Fix collateral row deletions in transfers & searches
modified:
  changelog.txt
  dwt/include/dwt/widgets/TableTree.h
  dwt/src/widgets/TableTree.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 'changelog.txt'
--- changelog.txt	2013-06-25 18:07:13 +0000
+++ changelog.txt	2013-07-05 21:25:29 +0000
@@ -2,6 +2,7 @@
 * [L#1194299] Prevent races when sending INF/MyINFO (maksis, poy)
 * [L#1194299] Prevent races when closing a connection (maksis, poy)
 * [ADC] Send the LC (locale) parameter in INF
+* [L#1197557] Fix collateral row deletions in transfers & searches (poy)
 
 -- 0.825 2013-06-18 --
 * [L#1191099] Group partial file list uploads to avoid a crash (poy)

=== modified file 'dwt/include/dwt/widgets/TableTree.h'
--- dwt/include/dwt/widgets/TableTree.h	2013-03-31 16:22:41 +0000
+++ dwt/include/dwt/widgets/TableTree.h	2013-07-05 21:25:29 +0000
@@ -102,9 +102,9 @@
 	int handleSort(LPARAM& lhs, LPARAM& rhs);
 
 #ifndef _MSC_VER /// @todo workaround for VS' sucky decltype
-	void eraseChild(decltype(children)::iterator& child);
+	void eraseChild(decltype(children)::iterator& child, bool deleting);
 #else
-	void eraseChild(std::unordered_map<LPARAM, LPARAM>::iterator& child);
+	void eraseChild(std::unordered_map<LPARAM, LPARAM>::iterator& child, bool deleting);
 #endif
 
 	LRESULT sendMsg(UINT msg, WPARAM wParam, LPARAM lParam);

=== modified file 'dwt/src/widgets/TableTree.cpp'
--- dwt/src/widgets/TableTree.cpp	2013-03-31 16:22:41 +0000
+++ dwt/src/widgets/TableTree.cpp	2013-07-05 21:25:29 +0000
@@ -114,7 +114,7 @@
 void TableTree::eraseChild(LPARAM child) {
 	auto i = children.find(child);
 	if(i != children.end()) {
-		eraseChild(i);
+		eraseChild(i, false);
 	}
 }
 
@@ -305,7 +305,9 @@
 
 	auto parent = items.find(param);
 	if(parent != items.end()) {
-		collapse(param);
+		if(parent->second.expanded) {
+			collapse(param);
+		}
 		for(auto child: parent->second.children) {
 			children.erase(child);
 		}
@@ -314,7 +316,7 @@
 
 	auto child = children.find(param);
 	if(child != children.end()) {
-		eraseChild(child);
+		eraseChild(child, true);
 	}
 }
 
@@ -360,13 +362,13 @@
 }
 
 #ifndef _MSC_VER /// @todo workaround for VS' sucky decltype
-void TableTree::eraseChild(decltype(children)::iterator& child) {
+void TableTree::eraseChild(decltype(children)::iterator& child, bool deleting) {
 #else
-void TableTree::eraseChild(std::unordered_map<LPARAM, LPARAM>::iterator& child) {
+void TableTree::eraseChild(std::unordered_map<LPARAM, LPARAM>::iterator& child, bool deleting) {
 #endif
 	auto& item = items[child->second];
 	auto& cont = item.children;
-	if(item.expanded) {
+	if(!deleting && item.expanded) {
 		sendMsg(LVM_DELETEITEM, findData(child->first), 0);
 	}
 	cont.erase(std::remove(cont.begin(), cont.end(), child->first), cont.end());