Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-109571

Make QSharedPointer and QWeakPointer QT_NO_SHARED_POINTER'able



    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • None


      The classes, annoyingly, are used in QPointer and QJniObject, so some version of them needs to stay around even when QT_NO_SHARED_POINTER is defined.

      While we should be able to port QPointer away from QWeakPointer (QTBUG-113366), QJniObject is a different beast.

      It seems to me that one way would be to rename the current classes to QSharedPointerImpl and QWeakPointerImpl and derive QSharedPointer and QWeakPointer privately from them. This should be BC an SC (thiago did something similar with QJson/CBor iterators and mmutz with QVarLengthArray), and allow to continue using the -Impl classes in the implementation of QJniObject while being able to hide QSP and QWP behind QT_NO_SHARED_POINTER. We cannot just make QSharedPointer a typedef to QSharedPointerImpl, as that would be BiC (changes function argument mangling), so we need a real class.

      The nice thing about this is that it allows us to introduce QT_NO_SHARED_POINTER sooner than Qt 7, when we could otherwise first do something about QJniObject, ensuring that new code doesn't add more uses.

      Acceptance criteria:

      • (old) QWeakPointer has been renamed to QWeakPointerImpl
      • (new) QWeakPointer inherits QWeakPointerImpl and is only defined when QT_NO_SHARED_POINTER isn't
      • ditto QSharedPointer/Impl
      • QJniObject ported to the Impl classes
      • QT_NO_SHARED_POINTER is enabled in all modules that already don't use QSharedPointer or QWeakPointer directly


        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              cnn Qt Core & Network
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              0 Vote for this issue
              1 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes