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

Qt Creator locks up when setting breakpoint after clipboard interaction

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • Qt Creator 4.5.2
    • Debugger
    • Qt version 5.3.2 (yes, I know this is ancient...), mingw 4.8.2

      Qt Creator 4.5.2 (at least this isn't!)

      Windows 7 64-bit

    Description

      I've got the following function where I'm trying to copy the data out of a QTableView to the clipboard in a format that will allow the resulting data to be pasted directly into an Excel spreadsheet. Here's the function:

       

      void plotContainerWidget::slotCopyTableToClipboard()
      {
       // select everything in table copy it to text string with
       // '\t' separating columns and '\n' separating rows
       if(mModel == 0)
       {
         return;
       }
       int rows = mModel->rowCount();
       int cols = mModel->columnCount();
       QString tableString;
       for(int i=0; i < cols; ++i)
       {
         tableString += mModel->headerData(i, Qt::Horizontal).toString();
         tableString += "\t";
       }
       tableString.chop(1); // remove extraneous tab
       tableString += "\n";
       for(int i=0; i < rows; ++i)
       {
         for(int j=0; j < cols; ++j)
         {
           tableString += mModel->data(mModel->index(i, j), Qt::DisplayRole).toString();
           tableString += "\t";
         }
         tableString.chop(1); // remove extraneous tab
         tableString += "\n";
       } 
       qDebug() << tableString; // string looks fine here
       QClipboard* clippy = QApplication::clipboard();
       clippy->setText(tableString);  // Qt Creator hangs on this line
       qDebug() << "copied table to clipboard";
      }

      When I execute this chunk of code within the debugger, it hangs at that QClipboard::setText() line. I first encountered it executing my code within the debugger, but without any breakpoints set. During that session, Qt Creator hung, and I had to force quit. After re-launching QtCreator, I set a breakpoint in this function and stepped through my code. The parsing is fine up until that line, the string looks good, but then Qt Creator hangs when that line setText() is executed. So this issue seems to happen whether I have any breakpoints set or not and interestingly this code does NOT hang when I choose "Run" from within Qt Creator, only when I choose "Start Debugging", even though that should still be executing the debug build of my application, just not running inside the debugger.

       

      Might be related to QTBUG-67729 and QTBUG-67822

       

      Attachments

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

        Activity

          People

            hjk hjk
            smurphy Sean Murphy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes