Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. One task QRunnable does not call a destructor
Forum Updated to NodeBB v4.3 + New Features

One task QRunnable does not call a destructor

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 231 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AlekseyB
    wrote on last edited by AlekseyB
    #1
    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved