Merge lp:~nick-dedekind/unity/smart-scopes.lp1159200 into lp:~unity-team/unity/libunity-7.0-breakage

Proposed by Nick Dedekind
Status: Merged
Approved by: Michal Hruby
Approved revision: no longer in the source branch.
Merged at revision: 3108
Proposed branch: lp:~nick-dedekind/unity/smart-scopes.lp1159200
Merge into: lp:~unity-team/unity/libunity-7.0-breakage
Diff against target: 70 lines (+22/-11)
1 file modified
UnityCore/ScopeProxy.cpp (+22/-11)
To merge this branch: bzr merge lp:~nick-dedekind/unity/smart-scopes.lp1159200
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michal Hruby (community) Approve
Review via email: mp+155742@code.launchpad.net

Commit message

Fixed crash when not receiving a valid reply for an activation request.

Description of the change

Fixed crash when not receiving a valid reply for an activation request.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

Not sure I like this, doesn't the error case deserve it's own branch?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'UnityCore/ScopeProxy.cpp'
--- UnityCore/ScopeProxy.cpp 2013-03-22 12:55:56 +0000
+++ UnityCore/ScopeProxy.cpp 2013-03-27 16:22:28 +0000
@@ -147,6 +147,9 @@
147147
148 static void OnScopeSearchCallback(GObject *source_object, GAsyncResult *res, gpointer user_data)148 static void OnScopeSearchCallback(GObject *source_object, GAsyncResult *res, gpointer user_data)
149 {149 {
150 if (!UNITY_PROTOCOL_IS_SCOPE_PROXY(source_object))
151 return;
152
150 std::unique_ptr<SearchData> data(static_cast<SearchData*>(user_data));153 std::unique_ptr<SearchData> data(static_cast<SearchData*>(user_data));
151 glib::Error error;154 glib::Error error;
152 std::unique_ptr<GHashTable, void(*)(GHashTable*)> hint_ret(unity_protocol_scope_proxy_search_finish(UNITY_PROTOCOL_SCOPE_PROXY(source_object), res, &error),155 std::unique_ptr<GHashTable, void(*)(GHashTable*)> hint_ret(unity_protocol_scope_proxy_search_finish(UNITY_PROTOCOL_SCOPE_PROXY(source_object), res, &error),
@@ -174,26 +177,34 @@
174 };177 };
175 static void OnScopeActivateCallback(GObject *source_object, GAsyncResult *res, gpointer user_data)178 static void OnScopeActivateCallback(GObject *source_object, GAsyncResult *res, gpointer user_data)
176 {179 {
180 if (!UNITY_PROTOCOL_IS_SCOPE_PROXY(source_object))
181 return;
182
177 std::unique_ptr<ActivateData> data(static_cast<ActivateData*>(user_data));183 std::unique_ptr<ActivateData> data(static_cast<ActivateData*>(user_data));
178 UnityProtocolActivationReplyRaw result;184 UnityProtocolActivationReplyRaw result;
185 memset(&result, 0, sizeof(UnityProtocolActivationReplyRaw));
179 glib::Error error;186 glib::Error error;
180 unity_protocol_scope_proxy_activate_finish(UNITY_PROTOCOL_SCOPE_PROXY(source_object), res, &result, &error);187 unity_protocol_scope_proxy_activate_finish(UNITY_PROTOCOL_SCOPE_PROXY(source_object), res, &result, &error);
181 if (error && g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))188
189 if (error)
182 {190 {
183 LOG_DEBUG(logger) << "Activate cancelled.";191 if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
184 return;192 {
193 LOG_DEBUG(logger) << "Activate cancelled.";
194 return;
195 }
196 if (data && data->callback)
197 data->callback(LocalResult(), ScopeHandledType::NOT_HANDLED, glib::HintsMap(), error);
185 }198 }
186199 else if (data && data->callback)
187 if (data && data->callback)
188 {200 {
189 ScopeHandledType handled = ScopeHandledType::NOT_HANDLED;201 ScopeHandledType handled = static_cast<ScopeHandledType>(result.handled);
190
191 data->result.uri = result.uri;
192 handled = static_cast<ScopeHandledType>(result.handled);
193202
194 glib::HintsMap hints;203 glib::HintsMap hints;
195 glib::hintsmap_from_hashtable(result.hints, hints);204 if (result.hints)
205 glib::hintsmap_from_hashtable(result.hints, hints);
196206
207 data->result.uri = glib::gchar_to_string(result.uri);
197 data->callback(data->result, handled, hints, error);208 data->callback(data->result, handled, hints, error);
198 }209 }
199 }210 }
@@ -224,10 +235,10 @@
224 if (!UNITY_PROTOCOL_IS_SCOPE_PROXY(source_object))235 if (!UNITY_PROTOCOL_IS_SCOPE_PROXY(source_object))
225 return;236 return;
226237
227 glib::Object<UnityProtocolScopeProxy> scope_proxy;
228 glib::Error error;238 glib::Error error;
229 DeeSerializableModel* serialisable_model = nullptr;239 DeeSerializableModel* serialisable_model = nullptr;
230 glib::String tmp_channel(unity_protocol_scope_proxy_open_channel_finish(UNITY_PROTOCOL_SCOPE_PROXY(source_object), res, &serialisable_model, &error));240 glib::String tmp_channel(unity_protocol_scope_proxy_open_channel_finish(UNITY_PROTOCOL_SCOPE_PROXY(source_object), res, &serialisable_model, &error));
241
231 if (error && g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))242 if (error && g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
232 {243 {
233 LOG_DEBUG(logger) << "Open channel cancelled.";244 LOG_DEBUG(logger) << "Open channel cancelled.";

Subscribers

People subscribed via source and target branches

to all changes: