mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 11:35:56 +00:00
fix: updateScript bug
1. 没有及时delete m_inputConvert,持续点击更新脚本导致内存持续增长 2. 重新new m_inputConvert之后没有connect grabCursor,导致grabCursor失效
This commit is contained in:
parent
f0e99b5a51
commit
22ec2eaf61
1 changed files with 5 additions and 3 deletions
|
@ -13,8 +13,6 @@ Controller::Controller(QString gameScript, QObject* parent) : QObject(parent)
|
|||
Q_ASSERT(m_receiver);
|
||||
|
||||
updateScript(gameScript);
|
||||
Q_ASSERT(m_inputConvert);
|
||||
connect(m_inputConvert, &InputConvertBase::grabCursor, this, &Controller::grabCursor);
|
||||
}
|
||||
|
||||
Controller::~Controller()
|
||||
|
@ -47,6 +45,9 @@ void Controller::test(QRect rc)
|
|||
|
||||
void Controller::updateScript(QString gameScript)
|
||||
{
|
||||
if (m_inputConvert) {
|
||||
delete m_inputConvert;
|
||||
}
|
||||
if (!gameScript.isEmpty()) {
|
||||
InputConvertGame* convertgame = new InputConvertGame(this);
|
||||
convertgame->loadKeyMap(gameScript);
|
||||
|
@ -54,7 +55,8 @@ void Controller::updateScript(QString gameScript)
|
|||
} else {
|
||||
m_inputConvert = new InputConvertNormal(this);
|
||||
}
|
||||
|
||||
Q_ASSERT(m_inputConvert);
|
||||
connect(m_inputConvert, &InputConvertBase::grabCursor, this, &Controller::grabCursor);
|
||||
}
|
||||
|
||||
void Controller::postTurnOn()
|
||||
|
|
Loading…
Add table
Reference in a new issue