Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-15308

CPU is hogged when using std::vector of std::unique_ptrs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • Qt Creator 3.5.1
    • C/C++/Obj-C++ Support
    • None
    • 64-bit OSX El Capitan, Qt 5.5.1 (Clang 6.0 (Apple), 64 bit)

    Description

      I have a Qt Widgets application that uses C++11. I have a very simple main.cpp that creates and uses a std::vector<std::unique_ptr<Obj>>. When I open main.cpp for edit, Qt Creator begins to consume one whole CPU. Every time I make a single-character edit, the CPU usage goes up by one CPU. Trying to quit leads it to hang, seemingly forever.

      main.cpp
      #include <vector>
      #include <memory>
      
      struct Obj
      {
          int fun() { return 1; }
      };
      
      int main(int argc, char *argv[])
      {
          std::vector<std::unique_ptr<Obj>> vec;
          vec.front()->fun();
          return 0;
      }
      

      The problem seems to only happen when I have the line vec.front()->fun(), and specifically only when I'm using the arrow operator on a unique_ptr that's in the vector.

      Attachments

        Issue Links

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

          Activity

            People

              kosjar Nikolai Kosjar
              poofypuffs asdf
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes