Skip to content

Commit 7c87ac0

Browse files
authored
Merge pull request #1217 from Unity-Technologies/unity-master-debugger-agent-mono-debugger-disconnect-fix
[debugger-agent] Fix mono_debugger_disconnect implementation
2 parents 2370e8a + bf8cb32 commit 7c87ac0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mono/mini/debugger-agent.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ static MonoCoopMutex debug_mutex;
764764

765765
static void transport_init (void);
766766
static void transport_connect (const char *address);
767+
static void transport_close2 (void);
767768
static gboolean transport_handshake (void);
768769
static void register_transport (DebuggerTransport *trans);
769770

@@ -1094,9 +1095,12 @@ mono_debugger_get_generate_debug_info ()
10941095
MONO_API void
10951096
mono_debugger_disconnect ()
10961097
{
1097-
stop_debugger_thread ();
1098-
transport_connect (agent_config.address);
1099-
start_debugger_thread ();
1098+
// We just need to close the debugger client socket since
1099+
// the thread is blocked in the RECV method. The debugger_thread
1100+
// loop already handles the debugger client disconnection properly,
1101+
// so calling transport_close2 method is enough since the method
1102+
// only closes the debugger client socket.
1103+
transport_close2();
11001104
}
11011105

11021106
typedef void (*MonoDebuggerAttachFunc)(gboolean attached);

0 commit comments

Comments
 (0)