mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-21 03:55:04 +00:00
解决退出时解码线程死锁问题
This commit is contained in:
parent
2f81e7372b
commit
3e906c51d3
2 changed files with 9 additions and 2 deletions
|
@ -18,6 +18,9 @@ DeviceSocket::~DeviceSocket()
|
|||
|
||||
qint32 DeviceSocket::recvData(quint8 *buf, qint32 bufSize)
|
||||
{
|
||||
if (m_quit) {
|
||||
return 0;
|
||||
}
|
||||
QMutexLocker locker(&m_mutex);
|
||||
|
||||
m_buffer = buf;
|
||||
|
@ -63,6 +66,7 @@ void DeviceSocket::onReadyRead()
|
|||
|
||||
void DeviceSocket::quitNotify()
|
||||
{
|
||||
m_quit = true;
|
||||
QMutexLocker locker(&m_mutex);
|
||||
if (m_buffer) {
|
||||
m_buffer = Q_NULLPTR;
|
||||
|
|
|
@ -18,10 +18,12 @@ public:
|
|||
protected:
|
||||
bool event(QEvent *event);
|
||||
|
||||
protected slots:
|
||||
void onReadyRead();
|
||||
public slots:
|
||||
void quitNotify();
|
||||
|
||||
protected slots:
|
||||
void onReadyRead();
|
||||
|
||||
private:
|
||||
QMutex m_mutex;
|
||||
QWaitCondition m_recvDataCond;
|
||||
|
@ -29,6 +31,7 @@ private:
|
|||
quint8* m_buffer = Q_NULLPTR;
|
||||
qint32 m_bufferSize = 0;
|
||||
qint32 m_dataSize = 0;
|
||||
bool m_quit = false;
|
||||
};
|
||||
|
||||
#endif // DEVICESOCKET_H
|
||||
|
|
Loading…
Add table
Reference in a new issue