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

Unified Diff: ui/base/x/x11_util.h

Issue 9333005: Fix some memory leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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 | « ui/base/touch/touch_factory.cc ('k') | ui/base/x/x11_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/x11_util.h
diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h
index 411c941baa1dfd4492fc86a866f3d145eeed0d3b..86955bf5d3e783ab89812b8f4f50b660aadadd0d 100644
--- a/ui/base/x/x11_util.h
+++ b/ui/base/x/x11_util.h
@@ -255,6 +255,21 @@ UI_EXPORT void InitXKeyEventForTesting(EventType type,
int flags,
XEvent* event);
+// Keeps track of a string returned by an X function (e.g. XGetAtomName) and
+// makes sure it's XFree'd.
+class UI_EXPORT XScopedString {
+ public:
+ explicit XScopedString(char* str) : string_(str) { }
+ ~XScopedString();
+
+ const char* string() const { return string_; }
+
+ private:
+ char* string_;
+
+ DISALLOW_COPY_AND_ASSIGN(XScopedString);
+};
+
} // namespace ui
#endif // UI_BASE_X_X11_UTIL_H_
« no previous file with comments | « ui/base/touch/touch_factory.cc ('k') | ui/base/x/x11_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698