← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

Re: [Merge] lp:~renatofilho/ubuntu-filemanager-app/fix-network-crash into lp:ubuntu-filemanager-app

 

Another and easy approach would be if the class NetworkListWorker receive again a const DirItemInfo *parent, but sets m_parent as its own instance using the operator '=', in this case it never gets deleted outside the worker thread.

Suppose the code changed:


NetworkListWorker::NetworkListWorker(LocationItemDirIterator * dirIterator,
                                     DirItemInfo * mainItemInfo, 
                                     const DirItemInfo *parent) :
    DirListWorker(dirIterator->path(),
                  dirIterator->filters(),
                  dirIterator->flags() == QDirIterator::Subdirectories ? true : false),
    m_dirIterator(dirIterator),
    m_mainItemInfo(mainItemInfo),
    m_parent(0)
{
     if (parent != 0)
     {
        m_parent = new UrlItemInfo();  // UrlItemInfo is for remote
        *m_parent = *parent;           // not sure it works, needs be reviewed
     }
     mLoaderType =  NetworkLoader;
     
     // this would not be necessary and can be removed
     parent->connectDestructionSignal(this, SLOT(onParentDestroyed()));
}


NetworkListWorker::~NetworkListWorker()
{
    delete m_dirIterator;
    delete m_mainItemInfo;
    if (m_parent != 0)
    {
       delete  m_parent;
    }
}
-- 
https://code.launchpad.net/~renatofilho/ubuntu-filemanager-app/fix-network-crash/+merge/314870
Your team Ubuntu File Manager Developers is subscribed to branch lp:ubuntu-filemanager-app.


Follow ups

References