Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QString::fromRawData ref count behavior
QtWS25 Last Chance

QString::fromRawData ref count behavior

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 439 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    primem0ver
    wrote on last edited by
    #1

    My software program needs to be able to manage its own string data for certain classes. Therefore I have a structure that creates a QString from data contained in those classes using the QString::fromRawData method. My question is what happens to that data when the reference count drops to zero? From my understanding QString deletes data when it is no longer needed (reference count is equal to zero). Is this true for QString created from raw data as well? I don't want a QString created with this method to delete the string data contained within their original classes and info regarding this possibility is not documented.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From the documentation, QString::fromRawData doesn't take ownership of the data it surveys.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved