Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • K KDeclarative
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Frameworks
  • KDeclarative
  • Merge requests
  • !122

QmlObject: Use std::shared_ptr to properly track the lifetime of QQmlEngine

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Arjen Hiemstra requested to merge work/ahiemstra/factorydelete into master May 13, 2022
  • Overview 2
  • Commits 2
  • Pipelines 3
  • Changes 4

The engine passed to QmlObject is potentially shared, either because it comes from QmlObjectSharedEngine or because the caller is already using it. Since raw pointers do not provide any information about that, deprecate the raw pointer constructors and replace them with a constructor taking a std::shared_ptr.

This allows QmlObject to properly track if its the first user of the QQmlEngine and if so, call KDeclarative::setupEngine on it. It also allows it to know if it is the last user of the engine, and in that case properly cleanup the QNAM factory, without affecting the shared engine case.

BUG: 451790

The second commit drops the KDeclarative instance from QmlObject, since the only remaining non-deprecated methods are static so we no longer need an instance to access them.

Edited May 13, 2022 by Arjen Hiemstra
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: work/ahiemstra/factorydelete