Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Unified Diff: ui/base/x/selection_requestor.cc

Issue 237583003: Delete the property returned by SelectionNotify as per ICCCM spec (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/selection_requestor.cc
diff --git a/ui/base/x/selection_requestor.cc b/ui/base/x/selection_requestor.cc
index 158028d515d878dc7df1889fa778f3f3ad33fe7a..83ab9780c71a5ce2c7e7237d9025bf1e85da9362 100644
--- a/ui/base/x/selection_requestor.cc
+++ b/ui/base/x/selection_requestor.cc
@@ -69,12 +69,15 @@ bool SelectionRequestor::PerformBlockingConvertSelection(
DCHECK_EQ(&pending_request, pending_requests_.back());
pending_requests_.pop_back();
- if (pending_request.returned_property != property_to_set)
- return false;
-
- return ui::GetRawBytesOfProperty(x_window_, pending_request.returned_property,
- out_data, out_data_bytes, out_data_items,
- out_type);
+ bool success = false;
+ if (pending_request.returned_property == property_to_set) {
+ success = ui::GetRawBytesOfProperty(x_window_,
+ pending_request.returned_property,
+ out_data, out_data_bytes,
+ out_data_items, out_type);
+ }
+ XDeleteProperty(x_display_, x_window_, pending_request.returned_property);
sadrul 2014/04/15 16:20:15 Should this be inside the if? and/or, should this
pkotwicz 2014/04/15 16:57:55 I checked and XDeleteProperty() does not do anythi
sadrul 2014/04/15 18:04:30 The man page claims XDeleteProperty can generate B
+ return success;
}
SelectionData SelectionRequestor::RequestAndWaitForTypes(
@@ -118,8 +121,13 @@ void SelectionRequestor::OnSelectionNotify(const XSelectionEvent& event) {
// This event doesn't correspond to any XConvertSelection calls that we
// issued in PerformBlockingConvertSelection. This shouldn't happen, but any
// client can send any message, so it can happen.
- if (!request_notified)
+ if (!request_notified) {
+ // ICCCM requires us to delete the property passed into SelectionNotify. If
+ // |request_notified| is true, the property will be deleted when the run
+ // loop has quit.
+ XDeleteProperty(x_display_, x_window_, event.property);
return;
+ }
request_notified->returned_property = event.property;
request_notified->returned = true;
« no previous file with comments | « no previous file | ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698