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. If I change the list of interesters on another thread while using the ejector?
Forum Updated to NodeBB v4.3 + New Features

If I change the list of interesters on another thread while using the ejector?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 178 Views 1 Watching
  • 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
    Pada_
    wrote on last edited by
    #1

    When expressing an iterator list in another case while using iterators?

    I am using Linux 64Bit Qt 5.4.0 version.

    I'm iterating through the list using an iterator, but there are times when the list is cleared or initialized in another thread.

    Then, the iterator is not referenced and appears as <not accessible> in debug, and checks such as if (obejct == NULL) do not work.

    Is there any way to determine if the reference object has changed and is a garbage value or not a normal value?

    JKSHJ 1 Reply Last reply
    0
    • P Pada_

      When expressing an iterator list in another case while using iterators?

      I am using Linux 64Bit Qt 5.4.0 version.

      I'm iterating through the list using an iterator, but there are times when the list is cleared or initialized in another thread.

      Then, the iterator is not referenced and appears as <not accessible> in debug, and checks such as if (obejct == NULL) do not work.

      Is there any way to determine if the reference object has changed and is a garbage value or not a normal value?

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by JKSH
      #2

      @Pada_ said in If I change the list of interesters on another thread while using the ejector?:

      I'm iterating through the list using an iterator, but there are times when the list is cleared or initialized in another thread.

      When you read/write a container from 2 different threads, you must guard access using a QMutex or QReadWriteLock. See https://doc.qt.io/qt-5/threads-reentrancy.html

      This prevents your iterator from becoming invalid halfway through the process.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      5

      • Login

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