Skip to content

Commit

Permalink
Don't try to close a channel over DBus when the proxy is not active.
Browse files Browse the repository at this point in the history
Approved by PS Jenkins bot, Nick Dedekind.

(bzr r3008.2.107)
  • Loading branch information
mhr3 authored and Tarmac committed Apr 12, 2013
2 parents 8100576 + 8201684 commit f7b3648
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions UnityCore/ScopeProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ void ScopeProxy::Impl::OnChannelOpened(glib::String const& opened_channel, glib:

void ScopeProxy::Impl::CloseChannel()
{
if (channel != "")
if (channel != "" && scope_proxy_connected_)
{
LOG_DEBUG(logger) << "Closing channel open for " << scope_data_->id();

Expand All @@ -447,14 +447,19 @@ void ScopeProxy::Impl::CloseChannel()
nullptr,
OnCloseChannel,
nullptr);
channel = "";
}
channel = "";
}

void ScopeProxy::Impl::OnCloseChannel(GObject *source_object, GAsyncResult *res, gpointer user_data)
{
glib::Error err;
unity_protocol_scope_proxy_close_channel_finish(UNITY_PROTOCOL_SCOPE_PROXY(source_object), res, &err);

if (err)
{
LOG_WARNING(logger) << "Unable to close channel: " << err;
}
}

void ScopeProxy::Impl::WaitForProxyConnection(GCancellable* cancellable,
Expand Down Expand Up @@ -608,7 +613,7 @@ void ScopeProxy::Impl::Activate(LocalResult const& result, uint activate_type, g

void ScopeProxy::Impl::OnScopeConnectedChanged(UnityProtocolScopeProxy* proxy, GParamSpec* param)
{
bool tmp_scope_proxy_connected = unity_protocol_scope_proxy_get_connected(scope_proxy_);
bool tmp_scope_proxy_connected = unity_protocol_scope_proxy_get_connected(scope_proxy_);
if (tmp_scope_proxy_connected != scope_proxy_connected_)
{
scope_proxy_connected_ = tmp_scope_proxy_connected;
Expand Down Expand Up @@ -799,4 +804,4 @@ Results::Ptr ScopeProxy::GetResultsForCategory(unsigned category) const


} // namespace dash
} // namespace unity
} // namespace unity

0 comments on commit f7b3648

Please sign in to comment.