Index: docs/callback.md |
diff --git a/docs/callback.md b/docs/callback.md |
index 6b7dd6931f5009a402696c7753c619a48ff98b62..4194d5107995219c4dc65919040635eddd42cc0c 100644 |
--- a/docs/callback.md |
+++ b/docs/callback.md |
@@ -152,6 +152,17 @@ void DoSomething(const RepeatingCallback<double(double)>& callback) { |
} |
``` |
+If running a callback could result in its own destruction (e.g., if the callback |
+recipient deletes the object the callback is a member of), the callback should |
+be moved before it can be safely invoked. The `base::ResetAndReturn` method |
+provides this functionality. |
+ |
+```cpp |
+void Foo::RunCallback() { |
+ base::ResetAndReturn(&foo_deleter_callback_).Run(); |
+} |
+``` |
+ |
### Passing Unbound Input Parameters |
Unbound parameters are specified at the time a callback is `Run()`. They are |