Bug 259483 - Checked chunks line displays uncorrectly
Summary: Checked chunks line displays uncorrectly
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-10 23:29 UTC by Alexey Shildyakov
Modified: 2011-02-10 18:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Active Torrents screenshot (96.51 KB, image/jpeg)
2010-12-12 16:35 UTC, Alexey Shildyakov
Details
All Torrents screenshot (48.08 KB, image/jpeg)
2010-12-12 16:35 UTC, Alexey Shildyakov
Details
My ktorrentrc (8.25 KB, text/plain)
2010-12-14 01:58 UTC, Alexey Shildyakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Shildyakov 2010-12-10 23:29:43 UTC
Version:           unspecified (using KDE 4.5.4) 
OS:                Linux

This bug relative to bug 248205.
The symptoms are the same.

I have 2 tabs: All torrents and Active torrents.
The checked chunks line and small left aligned copy in upper corner of windows are displayed. In every tab: All torrents and Active torrents.

Reproducible: Always




Git version of KTorrent
OS: Linux (x86_64) release 2.6.36-gentoo-r1
Compiler: x86_64-pc-linux-gnu-gcc
Comment 1 Joris Guisson 2010-12-11 13:14:04 UTC
Screenshot ?
Comment 2 Alexey Shildyakov 2010-12-12 16:34:19 UTC
The following screenshots were created at one time.
Comment 3 Alexey Shildyakov 2010-12-12 16:35:07 UTC
Created attachment 54463 [details]
Active Torrents screenshot
Comment 4 Alexey Shildyakov 2010-12-12 16:35:37 UTC
Created attachment 54464 [details]
All Torrents screenshot
Comment 5 Joris Guisson 2010-12-12 17:48:57 UTC
Can't seem to reproduce
Comment 6 Alexey Shildyakov 2010-12-14 01:57:56 UTC
Hmm... Just try the following steps:
1. Make tab 1: show All torrents
2. Make tab 2: show Active torrents
3. Choose tab 1
4. Add torrent, start download
5. Minimize to system tray
6. Wait until torrent will be downloaded (and finish checking chunks)
7. Restore KTorrent window
8. Now you on the tab 1. Choose tab 2.
9. Now you can see the incorrect chunks line

If it is helpful I attache my ktorrentrc file below.

Qt-4.7.1
Comment 7 Alexey Shildyakov 2010-12-14 01:58:45 UTC
Created attachment 54527 [details]
My ktorrentrc
Comment 8 Martin Walch 2011-01-13 20:56:45 UTC
I can observe the same phenomenon. The important point is that the KTorrent window is closed and ktorrent is only visible as an icon in the system tray. Then a check has to be executed. Now, when opening the main window again, you will see the misplaced torrent check. If several checks have been performed, the output of all of them is on the same place, so you absolutely can not read any of the numbers.
Comment 9 Alexey Shildyakov 2011-01-25 02:08:52 UTC
I opened new bug 264215 is might be related to this. As bug 248205 is depend on several opened tabs think this may depend on the several opend tabs situation too.
Comment 10 Joris Guisson 2011-01-25 19:17:16 UTC
Is this actually still reproducible with the latest code from git ?
Comment 11 Alexey Shildyakov 2011-01-26 17:10:37 UTC
Yes. Confirm this with latest git.
For small torrents, the chunk bar invalid only in tab 2. But for big (over 1 GiB, not tested the real size level) the bug appears in both tab 1 and tab 2.
The problem with tab 2 is a problem due the bug 264215.
Comment 12 Joris Guisson 2011-01-28 20:14:40 UTC
Git commit 24928b6fdaab272752308f2804ebb908dde33a77 by Joris.
Pushed by guisson into branch 'master'.

Update view tab when switching to it, fixes data scan widget showing in the wrong place

BUG: 259483

M  +1    -0    ChangeLog     
M  +1    -0    ktorrent/view/viewmanager.cpp     

http://commits.kde.org/e79f3103/24928b6fdaab272752308f2804ebb908dde33a77
Comment 13 Joris Guisson 2011-01-28 20:16:24 UTC
Git commit bb942105d72a8b096573f7dc687d1af2a778137b by Joris.
Pushed by guisson into branch '4.1'.

Backport to 4.1: Update view tab when switching to it, fixes data scan widget showing in the wrong place

CCBUG: 259483

M  +1    -0    ChangeLog     
M  +1    -0    ktorrent/view/viewmanager.cpp     

http://commits.kde.org/e79f3103/bb942105d72a8b096573f7dc687d1af2a778137b
Comment 14 Alexey Shildyakov 2011-01-30 02:58:12 UTC
The bug exists in latest Git.
Don't understand how update() will hide chunk bar. In the bug 248205 you create method View::extend(bt::TorrentInterface* tc,Extender* widget). Think this method should be applied in ViewManager::onCurrentTabChanged() or call tree.
Comment 15 Joris Guisson 2011-01-30 10:48:36 UTC
update() will hide all widgets of items which are not visible
Comment 16 Alexey Shildyakov 2011-01-31 23:23:34 UTC
Ok. I try to clarify the problem.
You expect that extenders will hide in ViewModel::update(ViewDelegate* delegate,bool force_resort):382.
Callback:
ViewManager::onCurrentTabChanged(QWidget* tab):264
View::update():140

They are not.
The situation when in tab 2 (Active torrents) there are no torrent actually active.
Local variable "hidden" is true for discussed torrent because the group "Active torrents" has no torrents.
Also Item::hidden is true.
So the result of expression at 376 is false. And hide action isn't executed at 382.
Also I noticed that the torrent in tab 2 (from ViewModel::torrents) hasn't been updated (it's been updated in tab 1), beacsue has wrong status "bt::ALLOCATING_DISKSPACE", and not updated info (bytes_downloaded, bytes_uploaded, etc).
So, the problem I think is: we start torrent in tab 1, the torrent became visible in tab 2 (because it will be downloaded and active). The torrent in tab 2 didn't change hidden value, but the extender started. Then KTorrent didn't change the value because expect that the torrent already changed status to hidden and hide extender.

There are 2 solutions:
1. Try to hide extenders for all torrents (otside "if" statement at 376-383)
2. Correctly update actual infromation (Item object) for torrents after changing tab.
Comment 17 Alexey Shildyakov 2011-02-01 09:01:43 UTC
In addition, if behavior will be this: after changed to tab 2 (Active torrents), the torrent still was active, but seconds later peers were disconected and the torrent became not active. The update() function still be executed every timer tick, so the problem will be gone because the hidden status will be changed.
Comment 18 Alexey Shildyakov 2011-02-09 15:21:04 UTC
--- ktorrent/view/viewmodel.cpp
+++ ktorrent/view/viewmodel.cpp
@@ -376,13 +376,14 @@
 			if (hidden != i->hidden)
 			{
 				i->hidden = hidden;
 				resort = true;
-				// hide the extender if there is one shown
-				if (hidden && delegate->extended(i->tc))
-					delegate->hideExtender(i->tc);
 			}
-			
+
+			// hide the extender if there is one shown
+			if (hidden && delegate->extended(i->tc))
+				delegate->hideExtender(i->tc);
+
 			if (!i->hidden)
 				num_visible++;
 			row++;
 		}

This solves the problem.
Comment 19 Joris Guisson 2011-02-10 18:43:30 UTC
Git commit c87d260837e264f25f4edc45e118caa55d23e954 by Joris.
Committed on 10/02/2011 at 18:41.
Pushed by guisson into branch 'master'.

Fix scanextenders showing when they are not supposed to.

Big thanks for Alexey Shildyakov for finding the solution.

BUG: 259483

M  +1    -0    ChangeLog     
M  +4    -3    ktorrent/view/viewmodel.cpp     

http://commits.kde.org/ktorrent/c87d260837e264f25f4edc45e118caa55d23e954
Comment 20 Joris Guisson 2011-02-10 18:44:50 UTC
Git commit a65290ddb5768b30e4f1a26a90bf28864ba41c66 by Joris.
Committed on 10/02/2011 at 18:41.
Pushed by guisson into branch '4.1'.

Backport to 4.1: Fix scanextenders showing when they are not supposed to.

Big thanks for Alexey Shildyakov for finding the solution.

CCBUG: 259483

M  +1    -0    ChangeLog     
M  +4    -3    ktorrent/view/viewmodel.cpp     

http://commits.kde.org/ktorrent/a65290ddb5768b30e4f1a26a90bf28864ba41c66