Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-30013

opCtx is a naked pointer, except where it's a std::unique_ptr<>.

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.5.9
    • Component/s: None
    • Labels:
      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.

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            nathan.myers Nathan Myers
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: