File tree Expand file tree Collapse file tree 5 files changed +16
-11
lines changed
Expand file tree Collapse file tree 5 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 2828#include < QFileInfoList>
2929#include < QMap>
3030#include < QSet>
31- using QAtomicBool = QAtomicInteger<unsigned short >; // 16 bit only (faster than using 8 bit variable...)
31+ using AtomicBool = QAtomicInteger<unsigned short >; // 16 bit only (faster than using 8 bit variable...)
3232using PathSet = QSet<QString>;
3333
3434class FolderScan
@@ -52,7 +52,7 @@ class FoldersMonitorForNewFiles : public QObject
5252private:
5353 QFileSystemWatcher _monitor; // !< monitor
5454 QMap<QString, FolderScan*> _folders; // !< track files processed (their date might be > _lastCheck)
55- QAtomicBool _stopListening;
55+ AtomicBool _stopListening;
5656
5757 static const ulong sMSleep = 1000 ; // !< 1sec in case we move file from samba or unrar when the system is quite loaded
5858
Original file line number Diff line number Diff line change @@ -53,9 +53,6 @@ class NzbCheck;
5353
5454#define NB_ARTICLES_TO_PREPARE_PER_CONNECTION 3
5555
56-
57- // using QAtomicBool = QAtomicInteger<unsigned short>; // 16 bit only (faster than using 8 bit variable...)
58-
5956#include < QTimer>
6057
6158/* !
Original file line number Diff line number Diff line change @@ -411,7 +411,8 @@ void PostingJob::onDisconnectedConnection(NntpConnection *con)
411411 if (con->hasNoMoreFiles ())
412412 {
413413 _finishPosting ();
414- emit noMoreConnection ();
414+ if (!_postFinished)
415+ emit noMoreConnection ();
415416 }
416417 else
417418 {
@@ -426,7 +427,8 @@ void PostingJob::onDisconnectedConnection(NntpConnection *con)
426427 else
427428 {
428429 _finishPosting ();
429- emit noMoreConnection ();
430+ if (!_postFinished)
431+ emit noMoreConnection ();
430432 }
431433 }
432434 }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class NntpArticle;
4040class PostingWidget ;
4141class Poster ;
4242
43- using QAtomicBool = QAtomicInteger<unsigned short >; // 16 bit only (faster than using 8 bit variable...)
43+ using AtomicBool = QAtomicInteger<unsigned short >; // 16 bit only (faster than using 8 bit variable...)
4444
4545/* !
4646 * \brief PostingJob is an active object that will do a posting job
@@ -120,8 +120,8 @@ class PostingJob : public QObject
120120 uint _nbArticlesTotal; // !< number of Articles of all the files to post
121121
122122
123- QAtomicBool _stopPosting;
124- QAtomicBool _noMoreFiles;
123+ AtomicBool _stopPosting;
124+ AtomicBool _noMoreFiles;
125125
126126 bool _postStarted;
127127 bool _packed;
@@ -131,7 +131,7 @@ class PostingJob : public QObject
131131 const bool _obfuscateFileName;
132132
133133
134- QAtomicBool _delFilesAfterPost;
134+ AtomicBool _delFilesAfterPost;
135135 const QFileInfoList _originalFiles;
136136
137137
Original file line number Diff line number Diff line change @@ -102,6 +102,11 @@ void PostingWidget::onArticlesNumber(int nbArticles)
102102
103103void PostingWidget::onPostingJobDone ()
104104{
105+ // we could arrive here twice: from PostingJob::postingFinished or PostingJob::noMoreConnection
106+ // This could happen especially when we exceed the number of connections allowed by a provider
107+ if (!_postingJob)
108+ return ;
109+
105110 if (_postingJob->nbArticlesTotal () > 0 )
106111 {
107112 if (_postingJob->nbArticlesFailed () > 0 )
@@ -112,6 +117,7 @@ void PostingWidget::onPostingJobDone()
112117 else
113118 _hmi->clearJobTab (this );
114119
120+ disconnect (_postingJob);
115121 _postingJob = nullptr ; // !< we don't own it, NgPost will delete it
116122 _postingFinished = true ;
117123 setIDLE ();
You can’t perform that action at this time.
0 commit comments