-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.5.9
-
Component/s: None
-
None
Throughout the server, OperationContexts are operated on via a naked pointer always named opCtx. Often there is a stdx::unique_ptr<OperationContext> (typedef'd "UniqueOperationContext") also named opCtx. There is no way to protect against a null opCtx, or any of myriad implicit, incorrect pointer operations.
- OperationContext should be renamed OperationContext::Impl.
- OperationContext itself should be a struct wrapping a std::unique_ptr<OperationContext::Impl>.
- Uses of OperationContext* in interfaces should be replaced with an OpCtxRef, wrapping a guaranteed non-null OperationContext::Impl*.
- Member functions of the present OperationContext should be moved to OpCtxRef or to Impl, according to usage.