Skip to content

Commit 8d3e521

Browse files
committed
bug fix
1 parent 35f7b07 commit 8d3e521

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

emmy_core/emmy_facade.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ int EmmyFacade::OnConnect(bool suc) {
137137
int EmmyFacade::OnDisconnect() {
138138
isIDEReady = false;
139139
isWaitingForIDE = false;
140+
L = nullptr;
141+
#if EMMY_BUILD_AS_HOOK
142+
attachedStates.clear();
143+
#endif
140144
Debugger::Get()->Stop();
141145
return 0;
142146
}
@@ -386,10 +390,7 @@ void EmmyFacade::SendLog(LogType type, const char *fmt, ...) {
386390

387391
void EmmyFacade::OnLuaStateGC(lua_State* L) {
388392
#if EMMY_BUILD_AS_HOOK
389-
Debugger::Get()->Stop();
390-
this->attachedStates.clear();
391-
this->isIDEReady = false;
392-
this->L = nullptr;
393+
OnDisconnect();
393394
#else
394395
Destroy();
395396
#endif

emmy_core/emmy_facade.hook.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void EmmyFacade::StartupHookMode(int port) {
4040
}
4141

4242
void EmmyFacade::Attach(lua_State* L) {
43-
if (this->isIDEReady)
43+
if (this->isIDEReady || !this->transporter->IsConnected())
4444
return;
4545
if (this->attachedStates.find(L) == this->attachedStates.end()) {
4646
this->attachedStates.insert(L);

0 commit comments

Comments
 (0)