Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,100
    • Issues 4,100
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #18108
Closed
Open
Issue created Jun 20, 2018 by Michael Werle@mwerle

"Open Project" button does not work with CMake 3.12 rc1 on Windows (compiled with QT4.8.7 / QT5.11)

Compiling CMake 3.12 (release branch) on Win(x64), VS2017, QT4.8.7 or QT5.11

The issue has been tracked down to the following coding construct:

doSomething( someQString.toLocal8Bit().data() );

data() returns a reference to a buffer internal to the temporary QByteArray returned by toLocal8Bit(). Once that object is destroyed, the reference is garbage. It appears to depend on the compiler used as to precisely when the destructor is invoked on the temporary object.

One of the replies in this Stackoverflow Question mentions this in this exact usage scenario; the official QT documentation mentions this as well.

The fix is to save the intermediate QByteArray in a variable to ensure it does not go out of scope for as long as the reference returned by data() is being used.

auto lstr = someQString.toLocal8Bit();
doSomething( lstr.data() );

While the issue was identified in the QCMake::checkOpenPossible(), the construct is used in various places and may be the cause of other errors.

A pull request shall be issued shortly to address this.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking