summaryrefslogtreecommitdiffstats
path: root/views/controls/menu
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-31 22:51:12 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-31 22:51:12 +0000
commitb32613252ab076e3ac26d7ecb1c5af383de64da1 (patch)
tree1b53e07db28a1ef9edca260b6f50cf4f8e40613e /views/controls/menu
parent8bc061ff0bb46a286dc61af8c28891a801b8492f (diff)
downloadchromium_src-b32613252ab076e3ac26d7ecb1c5af383de64da1.zip
chromium_src-b32613252ab076e3ac26d7ecb1c5af383de64da1.tar.gz
chromium_src-b32613252ab076e3ac26d7ecb1c5af383de64da1.tar.bz2
Converts creation of MenuRunner on the stack to be a field on the
class. This way if class is deleted MenuRunner is deleted too, instead of staying live for a while after the class is deleted. BUG=94915 TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/7776033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99069 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu')
-rw-r--r--views/controls/menu/menu_runner.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/views/controls/menu/menu_runner.h b/views/controls/menu/menu_runner.h
index 5cdb845..37b8440 100644
--- a/views/controls/menu/menu_runner.h
+++ b/views/controls/menu/menu_runner.h
@@ -32,6 +32,13 @@ class MenuRunnerImpl;
// the MenuRunner while the menu is running, your object is effectively still
// on the stack. A return value of MENU_DELETED indicated this. In most cases
// if RunMenuAt() returns MENU_DELETED, you should return immediately.
+//
+// Similarly you should avoid creating MenuRunner on the stack. Doing so means
+// MenuRunner may not be immediately destroyed if your object is destroyed,
+// resulting in possible callbacks to your now deleted object. Instead you
+// should define MenuRunner as a scoped_ptr in your class so that when your
+// object is destroyed MenuRunner initiates the proper cleanup and ensures your
+// object isn't accessed again.
class VIEWS_EXPORT MenuRunner {
public:
enum RunTypes {