mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 22:28:39 +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);
|
Q_ASSERT(m_receiver);
|
||||||
|
|
||||||
updateScript(gameScript);
|
updateScript(gameScript);
|
||||||
Q_ASSERT(m_inputConvert);
|
|
||||||
connect(m_inputConvert, &InputConvertBase::grabCursor, this, &Controller::grabCursor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller::~Controller()
|
Controller::~Controller()
|
||||||
|
@ -47,6 +45,9 @@ void Controller::test(QRect rc)
|
||||||
|
|
||||||
void Controller::updateScript(QString gameScript)
|
void Controller::updateScript(QString gameScript)
|
||||||
{
|
{
|
||||||
|
if (m_inputConvert) {
|
||||||
|
delete m_inputConvert;
|
||||||
|
}
|
||||||
if (!gameScript.isEmpty()) {
|
if (!gameScript.isEmpty()) {
|
||||||
InputConvertGame* convertgame = new InputConvertGame(this);
|
InputConvertGame* convertgame = new InputConvertGame(this);
|
||||||
convertgame->loadKeyMap(gameScript);
|
convertgame->loadKeyMap(gameScript);
|
||||||
|
@ -54,7 +55,8 @@ void Controller::updateScript(QString gameScript)
|
||||||
} else {
|
} else {
|
||||||
m_inputConvert = new InputConvertNormal(this);
|
m_inputConvert = new InputConvertNormal(this);
|
||||||
}
|
}
|
||||||
|
Q_ASSERT(m_inputConvert);
|
||||||
|
connect(m_inputConvert, &InputConvertBase::grabCursor, this, &Controller::grabCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::postTurnOn()
|
void Controller::postTurnOn()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue