Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 28322 Details for
Bug 41515
KGet crashes after QT 3.3 upgrade
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Remove threading from kget
kget-3.2.1-nothread.diff (text/plain), 9.12 KB, created by
Marc Ballarin
on 2004-03-29 14:39:49 UTC
(
hide
)
Description:
Remove threading from kget
Filename:
MIME Type:
Creator:
Marc Ballarin
Created:
2004-03-29 14:39:49 UTC
Size:
9.12 KB
patch
obsolete
>--- kget.old/slave.cpp 2004-02-28 10:52:37.000000000 +0100 >+++ kget/slave.cpp 2004-03-30 00:10:11.631685624 +0200 >@@ -36,10 +36,9 @@ > #include <assert.h> > > Slave::Slave(Transfer * _parent, const KURL & _src, const KURL & _dest) >- : QObject(), >- QThread() >+ : QObject() > { >- mDebug << ">>>>Entering" << endl; >+ sDebug << ">>>>Entering" << endl; > copyjob = NULL; > m_src = _src; > m_dest = _dest; >@@ -47,7 +46,7 @@ > > nPendingCommand = 0; > >- mDebug << ">>>>Leaving" << endl; >+ sDebug << ">>>>Leaving" << endl; > } > > Slave::~Slave() >@@ -55,18 +54,12 @@ > > void Slave::Op(SlaveCommand _cmd) > { >- mDebugIn << " _cmd = " << _cmd << endl; >+ sDebugIn << " _cmd = " << _cmd << endl; > >- if ( !running() ) // start on demand >- start(); >- >- mutex.lock(); > stack.push(_cmd); > nPendingCommand++; >- worker.wakeOne(); >- mutex.unlock(); >- >- mDebugOut << endl; >+ run(); >+ sDebugOut << endl; > } > > /** No descriptions */ >@@ -82,7 +75,7 @@ > SlaveEvent *e1 = new SlaveEvent(m_parent, _event, _msg); > > QApplication::postEvent(kapp->mainWidget(), (QEvent *) e1); >- mDebug << "Msg:" << "_msg = " << _msg << endl; >+ sDebug << "Msg:" << "_msg = " << _msg << endl; > } > > void Slave::InfoMessage(const QString & _msg) >@@ -90,115 +83,100 @@ > SlaveEvent *e1 = new SlaveEvent(m_parent, SLV_INFO, _msg); > > QApplication::postEvent(kapp->mainWidget(), (QEvent *) e1); >- mDebug << "Infor Msg:" << "_msg = " << _msg << endl; >+ sDebug << "Infor Msg:" << "_msg = " << _msg << endl; > } > > > > void Slave::run() > { >- mDebugIn << endl; >+ sDebugIn << endl; > > SlaveCommand cmd; >- bool running = true; > >- while (running) >+ switch (cmd = fetch_cmd()) > { >- if (!nPendingCommand) >- worker.wait(); >- switch (cmd = fetch_cmd()) >- { >- case RESTART: >- copyjob->kill(true); >- // fall through >- case RETR: >- mDebug << " FETCHED COMMAND RETR" << endl; >- KIO::Scheduler::checkSlaveOnHold( true ); >- copyjob = new KIO::GetFileJob(m_src, m_dest); >- copyjob->setAutoErrorHandlingEnabled(true); >- Connect(); >- PostMessage(SLV_RESUMED); >- break; >- >- case PAUSE: >- mDebug << " FETCHED COMMAND PAUSE" << endl; >- copyjob->kill(true); >- copyjob = 0L; >- PostMessage(SLV_PAUSED); >- break; >- >- case KILL: >- mDebug << " FETCHED COMMAND KILL" << endl; >- running = false; >- if (copyjob) >- { >- copyjob->kill(true); >- copyjob = 0L; >- } >- // no message posted >- break; >+ case RESTART: >+ copyjob->kill(true); >+ // fall through >+ case RETR: >+ sDebug << " FETCHED COMMAND RETR" << endl; >+ KIO::Scheduler::checkSlaveOnHold( true ); >+ copyjob = new KIO::GetFileJob(m_src, m_dest); >+ copyjob->setAutoErrorHandlingEnabled(true); >+ Connect(); >+ PostMessage(SLV_RESUMED); >+ break; >+ >+ case PAUSE: >+ sDebug << " FETCHED COMMAND PAUSE" << endl; >+ copyjob->kill(true); >+ copyjob = 0L; >+ PostMessage(SLV_PAUSED); >+ break; >+ >+ case KILL: >+ sDebug << " FETCHED COMMAND KILL" << endl; >+ if (copyjob) >+ copyjob->kill(true); >+ copyjob = 0L; >+ // no message posted >+ break; > >- case REMOVE: >- mDebug << " FETCHED COMMAND REMOVE" << endl; >- running = false; >- copyjob->kill(true); >- copyjob = 0L; >- PostMessage(SLV_REMOVED); >- break; >- >- case SCHEDULE: >- mDebug << " FETCHED COMMAND SCHEDULE" << endl; >- copyjob->kill(true); >- copyjob = 0L; >- PostMessage(SLV_SCHEDULED); >- break; >- >- case DELAY: >- mDebug << " FETCHED COMMAND DELAY" << endl; >- copyjob->kill(true); >- copyjob = 0L; >- PostMessage(SLV_DELAYED); >- break; >- >- case NOOP: >- mDebug << "FETCHED COMMAND NOOP, i.e. empty stack" << endl; >- if ( copyjob ) >- { >+ case REMOVE: >+ sDebug << " FETCHED COMMAND REMOVE" << endl; >+ copyjob->kill(true); >+ copyjob = 0L; >+ PostMessage(SLV_REMOVED); >+ break; >+ >+ case SCHEDULE: >+ sDebug << " FETCHED COMMAND SCHEDULE" << endl; >+ copyjob->kill(true); >+ copyjob = 0L; >+ PostMessage(SLV_SCHEDULED); >+ break; >+ >+ case DELAY: >+ sDebug << " FETCHED COMMAND DELAY" << endl; >+ copyjob->kill(true); >+ copyjob = 0L; >+ PostMessage(SLV_DELAYED); >+ break; >+ >+ case NOOP: >+ sDebug << "FETCHED COMMAND NOOP, i.e. empty stack" << endl; >+ if ( copyjob ) >+ { > copyjob->kill(true); > copyjob = 0L; >- } >- running = false; >- break; >- >- default: { >- mDebug << " UNKNOWN COMMAND DIE...." << endl; >- assert(0); > } >+ break; >+ >+ default: { >+ sDebug << " UNKNOWN COMMAND DIE...." << endl; >+ assert(0); > } > } >- >- copyjob = NULL; >- mDebugOut << endl; >+ sDebugOut << endl; > } > > > Slave::SlaveCommand Slave::fetch_cmd() > { >- mutex.lock(); > SlaveCommand cmd = NOOP; > if ( !stack.isEmpty() ) > { > nPendingCommand--; > cmd = stack.pop(); > } >- mutex.unlock(); > return cmd; > } > > > void Slave::Connect() > { >- mDebugIn << endl; >+ sDebugIn << endl; > > > connect(copyjob, SIGNAL(canceled(KIO::Job *)), SLOT(slotCanceled(KIO::Job *))); >@@ -213,75 +191,72 @@ > > connect(copyjob, SIGNAL(infoMessage(KIO::Job *, const QString &)), SLOT(slotInfoMessage(KIO::Job *, const QString &))); > >- mDebugOut << endl; >+ sDebugOut << endl; > } > > > void Slave::slotCanceled(KIO::Job *) > { >- mDebugIn << endl; >+ sDebugIn << endl; > > >- mDebugOut << endl; >+ sDebugOut << endl; > } > > void Slave::slotConnected(KIO::Job *) > { >- mDebugIn << endl; >+ sDebugIn << endl; > > >- mDebugOut << endl; >+ sDebugOut << endl; > } > > void Slave::slotResult(KIO::Job * job) > { >- mDebugIn << endl; >+ sDebugIn << endl; > if (job->error()) { > InfoMessage(job->errorString()); >- terminate(); // AEEIIII! >- wait(); > PostMessage(SLV_DELAYED); > } else > { >- terminate(); // AEEIIII! >- wait(); > PostMessage(SLV_FINISHED); > } >- mDebugOut << endl; >+ copyjob=0L; >+ sDebugOut << endl; > } > > > void Slave::slotSpeed(KIO::Job *, unsigned long lSpeed) > { >- // mDebugIn<<endl; >+ // sDebugIn<<endl; > PostMessage(SLV_PROGRESS_SPEED, lSpeed); >- // mDebugOut<<endl; >+ // sDebugOut<<endl; > > } > > void Slave::slotTotalSize(KIO::Job *, KIO::filesize_t _total_size) > { >- mDebugIn << "= " << (unsigned long) _total_size << endl; >+ sDebugIn << "= " << (unsigned long) _total_size << endl; > PostMessage(SLV_TOTAL_SIZE, _total_size); > > PostMessage(SLV_CAN_RESUME, copyjob->getCanResume()); > PostMessage(SLV_CONNECTED); >- mDebugOut << endl; >+ sDebugOut << endl; > } > > void Slave::slotProcessedSize(KIO::Job *, KIO::filesize_t _processed_size) > { >- // mDebugIn<<endl; >+ // sDebugIn<<endl; > PostMessage(SLV_PROGRESS_SIZE, _processed_size); > >- // mDebugOut<<endl; >+ // sDebugOut<<endl; > } > > void Slave::slotInfoMessage(KIO::Job *, const QString & _msg) > { >- mDebugIn << "MSG=" << _msg << endl; >+ sDebugIn << "MSG=" << _msg << endl; > InfoMessage(_msg); >- mDebugOut << endl; >+ sDebugOut << endl; > } > > #include "slave.moc" >--- kget.old/slave.h 2003-07-28 09:53:27.000000000 +0200 >+++ kget/slave.h 2004-03-29 23:57:55.924530112 +0200 >@@ -43,7 +43,7 @@ > > class Transfer; > >-class Slave:public QObject, public QThread >+class Slave:public QObject > { > Q_OBJECT > >@@ -95,8 +95,6 @@ > int nPendingCommand; > > QValueStack < SlaveCommand > stack; >- QWaitCondition worker; >- QMutex mutex; > KIO::GetFileJob * copyjob; > > }; >--- kget.old/transfer.cpp 2004-02-28 10:52:37.000000000 +0100 >+++ kget/transfer.cpp 2004-03-29 23:57:55.928529504 +0200 >@@ -162,14 +162,7 @@ > { > if ( m_pSlave ) > { >- if ( m_pSlave->running() ) >- { >- m_pSlave->Op(Slave::KILL); >- m_pSlave->wait(); >- } >- >- if ( m_pSlave->running() ) >- m_pSlave->terminate(); >+ m_pSlave->Op(Slave::KILL); > > delete m_pSlave; > m_pSlave = 0L; >@@ -789,7 +782,6 @@ > { > sDebugIn << endl; > >- m_pSlave->wait(); > emit statusChanged(this, OP_REMOVED); > sDebugOut << endl; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 41515
:
27492
| 28322