diff --git a/lib/base/session.vala b/lib/base/session.vala index eab36c49b..a162a7bb4 100644 --- a/lib/base/session.vala +++ b/lib/base/session.vala @@ -150,6 +150,11 @@ namespace Frida { public signal void new_candidates (string[] candidate_sdps); public signal void candidate_gathering_done (); + public weak AgentSession agent_session { + get; + construct; + } + public uint persist_timeout { get; construct; @@ -198,8 +203,10 @@ namespace Frida { INTERRUPTED } - public AgentMessageTransmitter (uint persist_timeout, MainContext frida_context, MainContext dbus_context) { + public AgentMessageTransmitter (AgentSession agent_session, uint persist_timeout, MainContext frida_context, + MainContext dbus_context) { Object ( + agent_session: agent_session, persist_timeout: persist_timeout, frida_context: frida_context, dbus_context: dbus_context @@ -500,8 +507,7 @@ namespace Frida { nice_connection.on_closed.connect (on_nice_connection_closed); try { - nice_registration_id = nice_connection.register_object (ObjectPath.AGENT_SESSION, - (AgentSession) this); + nice_registration_id = nice_connection.register_object (ObjectPath.AGENT_SESSION, agent_session); } catch (IOError io_error) { assert_not_reached (); } diff --git a/lib/payload/base-agent-session.vala b/lib/payload/base-agent-session.vala index 6b384c54c..878f24976 100644 --- a/lib/payload/base-agent-session.vala +++ b/lib/payload/base-agent-session.vala @@ -50,7 +50,7 @@ namespace Frida { script_engine.message_from_script.connect (on_message_from_script); script_engine.message_from_debugger.connect (on_message_from_debugger); - transmitter = new AgentMessageTransmitter (persist_timeout, frida_context, dbus_context); + transmitter = new AgentMessageTransmitter (this, persist_timeout, frida_context, dbus_context); transmitter.closed.connect (on_transmitter_closed); transmitter.new_candidates.connect (on_transmitter_new_candidates); transmitter.candidate_gathering_done.connect (on_transmitter_candidate_gathering_done); diff --git a/src/barebone/barebone-host-session.vala b/src/barebone/barebone-host-session.vala index 0bf8e3c9a..dd872b84f 100644 --- a/src/barebone/barebone-host-session.vala +++ b/src/barebone/barebone-host-session.vala @@ -343,7 +343,7 @@ namespace Frida { assert (frida_context != null); assert (dbus_context != null); - transmitter = new AgentMessageTransmitter (persist_timeout, frida_context, dbus_context); + transmitter = new AgentMessageTransmitter (this, persist_timeout, frida_context, dbus_context); transmitter.closed.connect (on_transmitter_closed); transmitter.new_candidates.connect (on_transmitter_new_candidates); transmitter.candidate_gathering_done.connect (on_transmitter_candidate_gathering_done);