Guest User

Untitled

a guest
Apr 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.05 KB | None | 0 0
  1. diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
  2. index f6234df..eb2a6b2 100644
  3. --- a/src/corelib/kernel/qobject.cpp
  4. +++ b/src/corelib/kernel/qobject.cpp
  5. @@ -165,6 +165,7 @@ QObjectPrivate::QObjectPrivate(int version)
  6.      pendTimer = false;                          // no timers yet
  7.      blockSig = false;                           // not blocking signals
  8.      wasDeleted = false;                         // double-delete catcher
  9. +    isDeletingChildren = false;                 // set by deleteChildren()
  10.      sendChildEvents = true;                     // if we should send ChildInsert and ChildRemove events to parent
  11.      receiveChildEvents = true;
  12.      postedEvents = 0;
  13. @@ -1660,8 +1661,8 @@ void QObject::setParent(QObject *parent)
  14.  
  15.  void QObjectPrivate::deleteChildren()
  16.  {
  17. -    const bool reallyWasDeleted = wasDeleted;
  18. -    wasDeleted = true;
  19. +    const bool reallyIsDeletingChildren = isDeletingChildren;
  20. +    isDeletingChildren = true;
  21.      // delete children objects
  22.      // don't use qDeleteAll as the destructor of the child might
  23.      // delete siblings
  24. @@ -1672,7 +1673,7 @@ void QObjectPrivate::deleteChildren()
  25.      }
  26.      children.clear();
  27.      currentChildBeingDeleted = 0;
  28. -    wasDeleted = reallyWasDeleted;
  29. +    isDeletingChildren = reallyIsDeletingChildren;
  30.  }
  31.  
  32.  void QObjectPrivate::setParent_helper(QObject *o)
  33. @@ -1682,13 +1683,13 @@ void QObjectPrivate::setParent_helper(QObject *o)
  34.          return;
  35.      if (parent) {
  36.          QObjectPrivate *parentD = parent->d_func();
  37. -        if (parentD->wasDeleted && wasDeleted
  38. +        if (parentD->isDeletingChildren && wasDeleted
  39.              && parentD->currentChildBeingDeleted == q) {
  40.              // don't do anything since QObjectPrivate::deleteChildren() already
  41.              // cleared our entry in parentD->children.
  42.          } else {
  43.              const int index = parentD->children.indexOf(q);
  44. -            if (parentD->wasDeleted) {
  45. +            if (parentD->isDeletingChildren) {
  46.                  parentD->children[index] = 0;
  47.              } else {
  48.                  parentD->children.removeAt(index);
  49. @@ -1715,7 +1716,7 @@ void QObjectPrivate::setParent_helper(QObject *o)
  50.              }
  51.          }
  52.      }
  53. -    if (!wasDeleted && declarativeData)
  54. +    if (!isDeletingChildren && declarativeData)
  55.          QAbstractDeclarativeData::parentChanged(declarativeData, q, o);
  56.  }
  57.  
  58. diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
  59. index 8702d37..3729dc8 100644
  60. --- a/src/corelib/kernel/qobject.h
  61. +++ b/src/corelib/kernel/qobject.h
  62. @@ -99,13 +99,14 @@ public:
  63.      uint pendTimer : 1;
  64.      uint blockSig : 1;
  65.      uint wasDeleted : 1;
  66. +    uint isDeletingChildren : 1;
  67.      uint ownObjectName : 1;
  68.      uint sendChildEvents : 1;
  69.      uint receiveChildEvents : 1;
  70.      uint inEventHandler : 1; //only used if QT_JAMBI_BUILD
  71.      uint inThreadChangeEvent : 1;
  72.      uint isWindow : 1; //for QWindow
  73. -    uint unused : 22;
  74. +    uint unused : 21;
  75.      int postedEvents;
  76.      QMetaObject *metaObject; // assert dynamic
  77.  };
Add Comment
Please, Sign In to add comment