Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

One task QRunnable does not call a destructor



  • using uint64 = unsigned int64_t;
    using cuint64 = const uint64;
    using string = std::string;
    using cstring = const string;
    
    class SyncTask: public QRunnable
        {
            cstring Information;
    
            const string& GetMirrorOfDataOnHDD();
    
        protected:
            uint QuantityError;
            const VariativeData& Settings;
    
            virtual void BasicProcedureOfTask(cstring& MirrorOfDataOnHDD) = 0;
            virtual SyncTask* CreateNewTask() = 0;
    
        public:
            cuint64 Key;
    
            SyncTask(const VariativeData& Settings_,
                     cstring& Information_,
                     uint QuantityError_);
    
            virtual ~SyncTask();
    
            void run();
        };
    
    class CountFile final: public SyncTask
        {
            cstring SubPathToFile;
            std::unordered_map<string, uint16>* const Tickers;
    
            void GetDataFromTextFile(cstring& FullPathReadFile, Array<allData>& ArrayForTask);
    
            void WriteFileForTicker(cstring& MirrorOfData, const MyLib::Array<allData>& ArrayOfFile, cstring& CurrentMonth, cuint16 IndexOfTicker);
    
            void WriteArrayToBinFiles(cstring& MirrorOfData, const Array<allData>& ArrayForTask);
    
            void BasicProcedureOfTask(cstring& MirrorOfData) override;
    
            SyncTask* CreateNewTask() override;
    
        public:
            CountFile(const VariativeData& Settings_,
                      cstring& SubPathToFile_,
                      void* const Tickers_ = nullptr,
                      uint QuantityError_ = 0)
                :
                  SubPathToFile(SubPathToFile_),
                  Tickers((std::unordered_map<string, uint16>*) Tickers_),
                  SyncTask(Settings_, SubPathToFile_, QuantityError_)
            {}
        };
    

    cuint64 Key - a unique value obtained with the help of the std::atomic<uint64>, with which I analyze the call of the destructor for tasks. In multithreaded mode, all tasks are performed, but for one is the destructor not called.

    I think this is mistake of the Qt- library.


Log in to reply