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

Move-construction QTextCharFormat crashes on iOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.1
    • GUI: Text handling
    • None
    • iOS/tvOS/watchOS

    Description

      While working on text-highlighter for an iOS-app I discovered some odd behavior using a global QTextCharFormat object.

      Basically calling a member of a QTextCharFormat and then move-construct that object into a global causes the app to crash on iOS (Works fine on Windows using MSVC)

      Here is a minimal example illustrating the problem:

      main.cpp

      #include <QTextCharFormat>
      
      QTextCharFormat makeKeywordFormat(const QBrush &pForeground, int pFontWeight)
      {
          QTextCharFormat format;
          format.setForeground(pForeground);
          format.setFontWeight(pFontWeight);
          return format;
      }
      
      const QBrush grayBrush(Qt::gray);
      const QTextCharFormat kDefaultFormat(makeKeywordFormat(grayBrush, QFont::Thin));
      
      int main(int, char **)
      {
          return 0;
      }
      

      minimal-demo.pro

      QT += core
      TARGET = minimal-demo
      CONFIG += c++17
      SOURCES += main.cpp
      

       

      Observed behavior:

      Only setFontWeight:

      21:36:51: Starting remote process.
      program received signal -111, thread:7d15b;

      00:00534d0101000000;01:7800408102000000;02:6000408102000000;03:b650b08102000000;04:ff00000000000000;05:0000000000000000;06:0000000000000000;07:0000000000000000;08:0000000000000000;09:0100000000000000;0a:0800000000000000;0b:0000000000000000;0c:0100000000000000;0d:0100000000000000;0e:0300000000000000;0f:a700000000000000;10:fb07000000000000;11:0000000000000000;12:0000000000000000;13:a00adb0101000000;14:c0f5da0101000000;15:5051236f01000000;16:e00a394802000000;17:1800000000000000;18:f885bc0001000000;19:f4f4bc0001000000;1a:8812490101000000;1b:0000000000000000;1c:1085bc0001000000;1d:d04d236f01000000;1e:2436d80001000000;1f:b04d236f01000000;20:dcc4170101000000;21:00000060;metype:1;mecount:2;medata:1;medata:c;memory:0x16f234dd0=f04d236f01000000d035d80001000000;memory:0x16f234df0=204e236f010000006cdfe20001000000;

      Repeated many times
      hit maximum number of consecutive signals, stopping 

      with setForeground

      rogram received signal 6, thread:7d2bb;00:0000000000000000;01:0000000000000000;02:0000000000000000;03:0000d00901000000;04:9032d00901000000;05:0d00000000000000;06:0a00000000000000;07:3f00000000000000;08:0008000000000000;09:2068511102000000;0a:a41e511102000000;0b:ed09984c02000000;0c:ed09984c02000000;0d:1500000000000000;0e:0100000000000000;0f:8108000000000000;10:4801000000000000;11:0000000000000000;12:0000000000000000;13:0600000000000000;14:802b7b0101000000;15:50d1966f01000000;16:0303000000000000;17:602c7b0101000000;18:f805490001000000;19:c874490001000000;1a:8892d50001000000;1b:0000000000000000;1c:1005490001000000;1d:a0cd966f01000000;1e:2020511102000000;1f:70cd966f01000000;20:0461491102000000;21:00000000;metype:5;mecount:2;medata:10003;medata:6;memory:0x16f96cda0=e0cd966f0100000078dd3e1102000000;memory:0x16f96cde0=10ce966f01000000181a880001000000;
      ASSERT failure in QVariant: "Trying to construct an unknown type", file kernel/qvariant.cpp, line 1421

      Repeated many times

      hit maximum number of consecutive signals, stopping

       

      Neither setForeground nor setFontWeight called works.

      Also moving the construction inside main works

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            joxye Johan Lindström
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes