rev 7954 - in kde-extras/ktorrent/trunk/debian: . patches

Modestas Vainius modax-guest at alioth.debian.org
Sun Nov 18 18:51:51 UTC 2007


Author: modax-guest
Date: 2007-11-18 18:51:50 +0000 (Sun, 18 Nov 2007)
New Revision: 7954

Added:
   kde-extras/ktorrent/trunk/debian/patches/10_r738262_crashfix_async_fileview.diff
   kde-extras/ktorrent/trunk/debian/patches/11_bug151289_workaround_for_setmaxrate.diff
Modified:
   kde-extras/ktorrent/trunk/debian/changelog
   kde-extras/ktorrent/trunk/debian/patches/98_buildprep.diff
   kde-extras/ktorrent/trunk/debian/patches/series
Log:
Preparing for -2. Two new patches, one of them - crash fix. not for release yet.

Modified: kde-extras/ktorrent/trunk/debian/changelog
===================================================================
--- kde-extras/ktorrent/trunk/debian/changelog	2007-11-18 15:25:16 UTC (rev 7953)
+++ kde-extras/ktorrent/trunk/debian/changelog	2007-11-18 18:51:50 UTC (rev 7954)
@@ -1,3 +1,16 @@
+ktorrent (2.2.3.dfsg.1-2~pre1) unstable; urgency=low
+
+  [ Modestas Vainius]
+  * Add new patches:
+    - 10_r738262_crashfix_async_fileview.diff - taken from upstream SVN
+      r738262. Reverts bogus threaded fileview update patch (that introduced
+      crashes) and implements the same functionally in a different way.
+    - 11_bug151289_workaround_for_setmaxrate.diff - implements a workaround
+      for a new KDE 3.5.8 bug, which broke setting of the max download or upload
+      speed via trayicon in some cases.
+
+ -- Debian KDE Extras Team <pkg-kde-extras at lists.alioth.debian.org>  Sun, 18 Nov 2007 20:00:49 +0200
+
 ktorrent (2.2.3.dfsg.1-1) unstable; urgency=low
 
   * New upstream release

Added: kde-extras/ktorrent/trunk/debian/patches/10_r738262_crashfix_async_fileview.diff
===================================================================
--- kde-extras/ktorrent/trunk/debian/patches/10_r738262_crashfix_async_fileview.diff	                        (rev 0)
+++ kde-extras/ktorrent/trunk/debian/patches/10_r738262_crashfix_async_fileview.diff	2007-11-18 18:51:50 UTC (rev 7954)
@@ -0,0 +1,468 @@
+Index: ktorrent/plugins/infowidget/fileviewupdatethread.h
+===================================================================
+--- ktorrent/plugins/infowidget/fileviewupdatethread.h	(revision 738261)
++++ ktorrent/plugins/infowidget/fileviewupdatethread.h	(revision 738262)
+@@ -1,57 +0,0 @@
+-/***************************************************************************
+- *   Copyright (C) 2007 by Jaak Ristioja                                   *
+- *   Ristioja at gmail.com                                                    *
+- *                                                                         *
+- *   This program is free software; you can redistribute it and/or modify  *
+- *   it under the terms of the GNU General Public License as published by  *
+- *   the Free Software Foundation; either version 2 of the License, or     *
+- *   (at your option) any later version.                                   *
+- *                                                                         *
+- *   This program is distributed in the hope that it will be useful,       *
+- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+- *   GNU General Public License for more details.                          *
+- *                                                                         *
+- *   You should have received a copy of the GNU General Public License     *
+- *   along with this program; if not, write to the                         *
+- *   Free Software Foundation, Inc.,                                       *
+- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
+- ***************************************************************************/
+-#ifndef KTFILEVIEWUPDATETHREAD_H
+-#define KTFILEVIEWUPDATETHREAD_H
+-
+-#include <qthread.h>
+-
+-namespace kt
+-{
+-	class FileView;
+-	class TorrentInterface;
+-	
+-	class FileViewUpdateThread : public QThread
+-	{
+-		public:
+-			FileViewUpdateThread(FileView* fileview);
+-			~FileViewUpdateThread();
+-			
+-			void start(kt::TorrentInterface* new_tc, QThread::Priority priority);
+-			void run();
+-			
+-			/**
+-				Stops the running thread. It will do this in the background so when
+-				returning from this function, the thread might not be completely
+-				stopped yet. This is done as a safety measure to prevent failure in
+-				arbitrary thread termination.
+-			*/
+-			void stop();
+-		
+-		private:
+-			bool fillFileTree();
+-		
+-		private:
+-			FileView* fileview;
+-			kt::TorrentInterface* new_tc;
+-			bool stopThread;
+-	};
+-};
+-
+-#endif
+Index: ktorrent/plugins/infowidget/fileviewupdatethread.cpp
+===================================================================
+--- ktorrent/plugins/infowidget/fileviewupdatethread.cpp	(revision 738261)
++++ ktorrent/plugins/infowidget/fileviewupdatethread.cpp	(revision 738262)
+@@ -1,129 +0,0 @@
+-/***************************************************************************
+- *   Copyright (C) 2007 by Jaak Ristioja                                   *
+- *   Ristioja at gmail.com                                                    *
+- *                                                                         *
+- *   This program is free software; you can redistribute it and/or modify  *
+- *   it under the terms of the GNU General Public License as published by  *
+- *   the Free Software Foundation; either version 2 of the License, or     *
+- *   (at your option) any later version.                                   *
+- *                                                                         *
+- *   This program is distributed in the hope that it will be useful,       *
+- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+- *   GNU General Public License for more details.                          *
+- *                                                                         *
+- *   You should have received a copy of the GNU General Public License     *
+- *   along with this program; if not, write to the                         *
+- *   Free Software Foundation, Inc.,                                       *
+- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
+- ***************************************************************************/
+-#include <kiconloader.h>
+-#include <kmimetype.h>
+-#include <interfaces/functions.h>
+-#include <interfaces/torrentinterface.h>
+-#include <interfaces/torrentfileinterface.h>
+-#include "iwfiletreeitem.h"
+-#include "iwfiletreediritem.h"
+-#include "fileview.h"
+-#include "fileviewupdatethread.h"
+-
+-namespace kt
+-{
+-	FileViewUpdateThread::FileViewUpdateThread(FileView* fileview)
+-		: fileview(fileview), stopThread(true)
+-	{
+-		// empty
+-	}
+-	
+-	FileViewUpdateThread::~FileViewUpdateThread()
+-	{
+-		// empty
+-	}
+-	
+-	void FileViewUpdateThread::start(kt::TorrentInterface* new_tc, QThread::Priority priority) {
+-		stopThread = false;
+-		this->new_tc = new_tc;
+-		QThread::start(priority);
+-	}
+-	
+-	void FileViewUpdateThread::run()
+-	{
+-		fileview->setEnabled(false);
+-		
+-		if (!fillFileTree()) return;
+-		
+-		if (new_tc != 0) {
+-			QObject::connect(
+-					new_tc,
+-	 				SIGNAL(missingFilesMarkedDND( kt::TorrentInterface* )),
+-					fileview,
+-	 				SLOT(refreshFileTree( kt::TorrentInterface* ))
+-				);
+-			fileview->setEnabled(true);
+-		}
+-	}
+-	
+-	void FileViewUpdateThread::stop()
+-	{
+-		stopThread = true;
+-	}
+-	
+-	bool FileViewUpdateThread::fillFileTree()
+-	{
+-		fileview->eventlock.lock();
+-		fileview->curr_tc = new_tc;
+-		fileview->multi_root = 0;
+-		fileview->clear();
+-		fileview->eventlock.unlock();
+-		
+-		if (!fileview->curr_tc)
+-			return true;
+-		
+-		if (fileview->curr_tc->getStats().multi_file_torrent)
+-		{
+-			fileview->eventlock.lock();
+-			IWFileTreeDirItem* root = new IWFileTreeDirItem(
+-					fileview,
+-					fileview->curr_tc->getStats().torrent_name
+-				);
+-			fileview->eventlock.unlock();
+-			
+-			for (Uint32 i = 0; i < fileview->curr_tc->getNumFiles(); i++)
+-			{
+-				TorrentFileInterface & file = fileview->curr_tc->getTorrentFile(i);
+-				
+-				fileview->eventlock.lock();
+-				root->insert(file.getPath(), file);
+-				if (stopThread) {
+-					fileview->clear();
+-					fileview->eventlock.unlock();
+-					return false;
+-				}
+-				fileview->eventlock.unlock();
+-			}
+-			fileview->eventlock.lock();
+-			root->setOpen(true);
+-			fileview->setRootIsDecorated(true);
+-			fileview->multi_root = root;
+-			fileview->multi_root->updatePriorityInformation(fileview->curr_tc);
+-			fileview->multi_root->updatePercentageInformation();
+-			fileview->multi_root->updatePreviewInformation(fileview->curr_tc);
+-			fileview->eventlock.unlock();
+-		}
+-		else
+-		{
+-			const TorrentStats & s = fileview->curr_tc->getStats();
+-			fileview->eventlock.lock();
+-			fileview->setRootIsDecorated(false);
+-			KListViewItem* item = new KListViewItem(
+-					fileview,
+-					s.torrent_name,
+-					BytesToString(s.total_bytes)
+-				);
+-			
+-			item->setPixmap(0, KMimeType::findByPath(s.torrent_name)->pixmap(KIcon::Small));
+-			fileview->eventlock.unlock();
+-		}
+-		return true;
+-	}
+-} // namespace kt
+Index: ktorrent/plugins/infowidget/fileview.h
+===================================================================
+--- ktorrent/plugins/infowidget/fileview.h	(revision 738261)
++++ ktorrent/plugins/infowidget/fileview.h	(revision 738262)
+@@ -21,16 +21,13 @@
+ #define KTFILEVIEW_H
+ 
+ #include <klistview.h>
+-#include <qmutex.h>
+ #include <util/constants.h>
++#include <qtimer.h>
+ 
+-class KPopupMenu;
+-
+ namespace kt
+ {
+ 	class TorrentInterface;
+ 	class IWFileTreeDirItem;
+-	class FileViewUpdateThread;
+ 
+ 	/**
+ 		@author Joris Guisson <joris.guisson at gmail.com>
+@@ -39,24 +36,20 @@
+ 	{
+ 		Q_OBJECT
+ 	public:
+-		friend class FileViewUpdateThread;
+-		
+ 		FileView(QWidget *parent = 0, const char *name = 0);
+ 		virtual ~FileView();
+ 
+ 		void update();
+ 		void changeTC(kt::TorrentInterface* tc);
+-	
+-	protected:
+-		virtual void viewportPaintEvent(QPaintEvent* pe);
+-	
+ 	private slots:
+ 		void contextItem(int id);
+ 		void showContextMenu(KListView* ,QListViewItem* item,const QPoint & p);
+ 		void refreshFileTree(kt::TorrentInterface* tc);
+ 		void onDoubleClicked(QListViewItem* item,const QPoint & ,int );
++		void fillTreePartial();
+ 		
+ 	private:
++		void fillFileTree();
+ 		void readyPreview();
+ 		void readyPercentage();
+ 		void changePriority(QListViewItem* item, bt::Priority newpriority);
+@@ -64,16 +57,18 @@
+ 	private:
+ 		kt::TorrentInterface* curr_tc;
+ 		IWFileTreeDirItem* multi_root;
++		bool pending_fill;
+ 		KPopupMenu* context_menu;
+-		FileViewUpdateThread* update_thread;
+ 		QString preview_path;
+-		QMutex eventlock;	// To avoid segfaults when events reach the listview while updating in background
++		QTimer fill_timer;
+ 		int preview_id;
+ 		int first_id;
+ 		int normal_id;
+ 		int last_id;
+ 		int dnd_keep_id;
+ 		int dnd_throw_away_id;
++
++		int next_fill_item;
+ 	};
+ 
+ }
+Index: ktorrent/plugins/infowidget/fileview.cpp
+===================================================================
+--- ktorrent/plugins/infowidget/fileview.cpp	(revision 738261)
++++ ktorrent/plugins/infowidget/fileview.cpp	(revision 738262)
+@@ -17,12 +17,13 @@
+  *   Free Software Foundation, Inc.,                                       *
+  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
+  ***************************************************************************/
++#include <klocale.h>
+ #include <kiconloader.h>
+-#include <klocale.h>
+ #include <kglobal.h>
+ #include <kpopupmenu.h>
+ #include <krun.h>
+ #include <kmessagebox.h>
++#include <kmimetype.h>
+ #include <util/bitset.h>
+ #include <util/functions.h>
+ #include <interfaces/functions.h>
+@@ -32,7 +33,6 @@
+ #include "functions.h"
+ #include "iwfiletreeitem.h"
+ #include "iwfiletreediritem.h"
+-#include "fileviewupdatethread.h"
+ #include "fileview.h"
+ 		
+ using namespace bt;
+@@ -41,10 +41,8 @@
+ {
+ 
+ 	FileView::FileView(QWidget *parent, const char *name)
+-			: KListView(parent, name),curr_tc(0),multi_root(0)
++	    : KListView(parent, name),curr_tc(0),multi_root(0),pending_fill(0),next_fill_item(0)
+ 	{
+-		update_thread = new FileViewUpdateThread(this);
+-		
+ 		setFrameShape(QFrame::NoFrame);
+ 		addColumn( i18n( "File" ) );
+     	addColumn( i18n( "Size" ) );
+@@ -53,7 +51,6 @@
+     	addColumn( i18n( "% Complete" ) );
+ 		setShowSortIndicator(true);
+ 		
+-		KIconLoader* iload = KGlobal::iconLoader();
+ 		context_menu = new KPopupMenu(this);
+ 		preview_id = context_menu->insertItem(SmallIcon("fileopen"),i18n("Open"));
+ 	    context_menu->insertSeparator();
+@@ -78,6 +75,8 @@
+ 		connect(this,SIGNAL(doubleClicked( QListViewItem*, const QPoint&, int )),
+ 				this,SLOT(onDoubleClicked(QListViewItem*, const QPoint&, int)));
+ 		
++		connect(&fill_timer, SIGNAL(timeout()), this, SLOT( fillTreePartial() ) );
++
+ 		setEnabled(false);
+ 		
+ 		setSelectionMode(QListView::Extended);
+@@ -85,25 +84,77 @@
+ 
+ 
+ 	FileView::~FileView()
++	{}
++	
++#define ITEMS_PER_TICK 100
++	
++	void FileView::fillTreePartial()
+ 	{
+-		if (update_thread) {
+-			update_thread->stop();
+-			update_thread->wait();
++		int cnt = 0;
++		while (next_fill_item < curr_tc->getNumFiles() && cnt < ITEMS_PER_TICK)
++		{
++			TorrentFileInterface & file = curr_tc->getTorrentFile(next_fill_item);
++			multi_root->insert(file.getPath(),file);
++			cnt++;
++			next_fill_item++;
+ 		}
+-		delete update_thread;
++		
++		if (next_fill_item >= curr_tc->getNumFiles()) 
++		{
++			multi_root->setOpen(true);
++			setRootIsDecorated(true);
++			setEnabled(true);
++			multi_root->updatePriorityInformation(curr_tc);
++			multi_root->updatePercentageInformation();
++			multi_root->updatePreviewInformation(curr_tc);
++			fill_timer.stop();
++			connect(curr_tc,SIGNAL(missingFilesMarkedDND( kt::TorrentInterface* )),
++				this,SLOT(refreshFileTree( kt::TorrentInterface* )));
++		}
++		else
++			fill_timer.start(0,true);
+ 	}
++    
++	void FileView::fillFileTree()
++	{
++		multi_root = 0;
++		clear();
++	
++		if (!curr_tc)
++			return;
++	
++		if (curr_tc->getStats().multi_file_torrent)
++		{
++			setEnabled(false);
++			multi_root = new IWFileTreeDirItem(this,curr_tc->getStats().torrent_name);
++			next_fill_item = 0;
++			fillTreePartial();
++		}
++		else
++		{
++			const TorrentStats & s = curr_tc->getStats();
++			this->setRootIsDecorated(false);
++			KListViewItem* item = new KListViewItem(
++					this,
++					s.torrent_name,
++					BytesToString(s.total_bytes));
++	
++			item->setPixmap(0,KMimeType::findByPath(s.torrent_name)->pixmap(KIcon::Small));
++			setEnabled(true);
++			connect(curr_tc,SIGNAL(missingFilesMarkedDND( kt::TorrentInterface* )),
++				this,SLOT(refreshFileTree( kt::TorrentInterface* )));
++		}
++	}
+ 
+ 	void FileView::changeTC(kt::TorrentInterface* tc)
+ 	{
+ 		if (tc == curr_tc)
+ 			return;
+-		
+-		if (update_thread) {
+-			update_thread->stop();
+-			update_thread->wait();
+-		}
+-		
+-		update_thread->start(tc, QThread::LowPriority);
++	
++		curr_tc = tc;
++		pending_fill = true;
++		fill_timer.stop();
++		fillFileTree();
+ 	}
+ 	
+ 	void FileView::update()
+@@ -111,19 +162,13 @@
+ 		if (!curr_tc)
+ 			return;
+ 		
+-		if (isVisible())
++		if (isVisible() && !pending_fill)
+ 		{
+ 			readyPreview();
+ 			readyPercentage();
+ 		}
+ 	}
+ 	
+-	void FileView::viewportPaintEvent(QPaintEvent* pe) {
+-		eventlock.lock();
+-		KListView::viewportPaintEvent(pe);
+-		eventlock.unlock();
+-	}
+-	
+ 	void FileView::readyPercentage()
+ 	{
+ 		if (curr_tc && !curr_tc->getStats().multi_file_torrent)
+Index: ktorrent/plugins/infowidget/Makefile.am
+===================================================================
+--- ktorrent/plugins/infowidget/Makefile.am	(revision 738261)
++++ ktorrent/plugins/infowidget/Makefile.am	(revision 738262)
+@@ -2,12 +2,12 @@
+ METASOURCES = AUTO
+ kde_module_LTLIBRARIES = ktinfowidgetplugin.la
+ noinst_HEADERS = infowidgetplugin.h infowidgetprefpage.h trackerview.h GeoIP.h \
+-	statustab.h fileview.h fileviewupdatethread.h
++	statustab.h fileview.h 
+ ktinfowidgetplugin_la_SOURCES = infowidgetplugin.cpp availabilitychunkbar.cpp \
+ 	chunkbar.cpp chunkdownloadview.cpp downloadedchunkbar.cpp flagdb.cpp peerview.cpp \
+ 	ktorrentmonitor.cpp iwfiletreediritem.cpp iwfiletreeitem.cpp infowidgetprefpage.cpp \
+ 	infowidgetpluginsettings.kcfgc iwpref.ui trackerviewbase.ui trackerview.cpp floatspinbox.cpp \
+-	localefloatvalidator.cpp chunkdownloadviewbase.ui statustabbase.ui statustab.cpp fileview.cpp fileviewupdatethread.cpp
++	localefloatvalidator.cpp chunkdownloadviewbase.ui statustabbase.ui statustab.cpp fileview.cpp 
+ 
+ # Libs needed by the plugin
+ ktinfowidgetplugin_la_LIBADD = ../../libktorrent/libktorrent.la \
+Index: ktorrent/apps/ktorrent/main.cpp
+===================================================================
+--- ktorrent/apps/ktorrent/main.cpp	(revision 738261)
++++ ktorrent/apps/ktorrent/main.cpp	(revision 738262)
+@@ -156,11 +156,11 @@
+ 	about.addCredit("twisted_fall",I18N_NOOP("Patch to not show very low speeds"),"twisted.fall at gmail.com");
+ 	about.addCredit("Lucke",I18N_NOOP("Patch to show potentially firewalled status"),0);
+ 	about.addCredit("Modestas Vainius",I18N_NOOP("Several patches"),"modestas at vainius.eu");
+-	about.addCredit("Jaak Ristioja",I18N_NOOP("Patch to update the FileView in a separate thread"),"Ristioja at gmail.com");
+ 	about.addCredit("Stefan Monov",I18N_NOOP("Patch to hide the menubar"),"logixoul at gmail.com");
+ 	about.addCredit("The_Kernel",I18N_NOOP("Patch to modify file priorities in the webgui"),"kernja at cs.earlham.edu");
+ 	about.addCredit("Rafał Miłecki",I18N_NOOP("Several webgui patches"),"zajec5 at gmail.com");
+ 	about.addCredit("Lukasz Fibinger",I18N_NOOP("Filterbar patch"),"lucke at o2.pl");
++	about.addCredit("Jindrich Makovicka",I18N_NOOP("Non threaded fileview update patch"),"makovick at gmail.com");
+ 
+ 	KCmdLineArgs::init(argc, argv, &about);
+ 	KCmdLineArgs::addCmdLineOptions(options);

Added: kde-extras/ktorrent/trunk/debian/patches/11_bug151289_workaround_for_setmaxrate.diff
===================================================================
--- kde-extras/ktorrent/trunk/debian/patches/11_bug151289_workaround_for_setmaxrate.diff	                        (rev 0)
+++ kde-extras/ktorrent/trunk/debian/patches/11_bug151289_workaround_for_setmaxrate.diff	2007-11-18 18:51:50 UTC (rev 7954)
@@ -0,0 +1,18 @@
+diff -uNr -x debian -x .pc ktorrent-2.2.3.dfsg.1/apps/ktorrent/trayicon.cpp ktorrent-2.2.3.dfsg.1/apps/ktorrent/trayicon.cpp
+--- ktorrent-2.2.3.dfsg.1/apps/ktorrent/trayicon.cpp	2007-11-18 19:39:34.000000000 +0200
++++ ktorrent-2.2.3.dfsg.1/apps/ktorrent/trayicon.cpp	2007-11-18 19:41:23.000000000 +0200
+@@ -350,10 +350,12 @@
+ void SetMaxRate::rateSelected(int id)
+ {
+ 	int rate;
+-	if(text(id).contains(i18n("Unlimited")))
++	QString ratestr = text(id).remove('&');
++
++	if(ratestr.contains(i18n("Unlimited")))
+ 		rate=0;
+ 	else
+-		rate=text(id).toInt();
++		rate=ratestr.toInt();
+ 	if(type==0)
+ 	{
+ 		m_core->setMaxUploadSpeed(rate);

Modified: kde-extras/ktorrent/trunk/debian/patches/98_buildprep.diff
===================================================================

Modified: kde-extras/ktorrent/trunk/debian/patches/series
===================================================================
--- kde-extras/ktorrent/trunk/debian/patches/series	2007-11-18 15:25:16 UTC (rev 7953)
+++ kde-extras/ktorrent/trunk/debian/patches/series	2007-11-18 18:51:50 UTC (rev 7954)
@@ -2,4 +2,6 @@
 02_am_maintainer_mode.diff
 03_pedantic-errors.diff
 04_disable_no_undefined.diff
+10_r738262_crashfix_async_fileview.diff
+11_bug151289_workaround_for_setmaxrate.diff
 98_buildprep.diff




More information about the pkg-kde-commits mailing list