Ticket #9057: remotefile_deadlock.diff

File remotefile_deadlock.diff, 1.0 KB (added by stuartm, 14 years ago)

Possible fix

  • mythtv/libs/libmythdb/remotefile.cpp

     
    163163                     QString(", error was %1").arg(strlist[1]) :
    164164                     QString(", remote error")));
    165165        }
    166 
    167         // Close the sockets if we received an error so that isOpen() will
    168         // return false if the caller tries to use the RemoteFile.
    169         Close();
    170166    }
    171167
    172168    return lsock;
     
    176172{
    177173    QMutexLocker locker(&lock);
    178174    controlSock = openSocket(true);
     175    if (!controlSock)
     176        return false;
     177
    179178    sock = openSocket(false);
    180     return isOpen();
     179    if (!sock)
     180    {
     181        // Close the sockets if we received an error so that isOpen() will
     182        // return false if the caller tries to use the RemoteFile.
     183        locker.unlock();
     184        Close();
     185        return false;
    181186}
     187    return true;
     188}
    182189
    183190void RemoteFile::Close(void)
    184191{