Commit ed3b9849 authored by hjk's avatar hjk
Browse files

debugger: fix bug in new watch model that led to not re-fetching outdated information.

parent 41ec53b6
...@@ -82,16 +82,16 @@ static int generationCounter = 0; ...@@ -82,16 +82,16 @@ static int generationCounter = 0;
class WatchItem : public WatchData class WatchItem : public WatchData
{ {
public: public:
WatchItem() { parent = 0; fetchedTriggered = 0; } WatchItem() { parent = 0; fetchTriggered = false; }
WatchItem(const WatchData &data) : WatchData(data) WatchItem(const WatchData &data) : WatchData(data)
{ parent = 0; fetchedTriggered = 0; } { parent = 0; fetchTriggered = false; }
void setData(const WatchData &data) void setData(const WatchData &data)
{ static_cast<WatchData &>(*this) = data; } { static_cast<WatchData &>(*this) = data; }
WatchItem *parent; WatchItem *parent;
bool fetchedTriggered; // children fetch has been triggered bool fetchTriggered; // children fetch has been triggered
QList<WatchItem *> children; // fetched children QList<WatchItem *> children; // fetched children
}; };
...@@ -303,7 +303,7 @@ WatchModel::WatchModel(WatchHandler *handler, WatchType type) ...@@ -303,7 +303,7 @@ WatchModel::WatchModel(WatchHandler *handler, WatchType type)
item->hasChildren = true; item->hasChildren = true;
item->state = 0; item->state = 0;
item->parent = m_root; item->parent = m_root;
item->fetchedTriggered = true; item->fetchTriggered = true;
m_root->children.append(item); m_root->children.append(item);
} }
...@@ -346,9 +346,11 @@ void WatchModel::removeOutdatedHelper(WatchItem *item) ...@@ -346,9 +346,11 @@ void WatchModel::removeOutdatedHelper(WatchItem *item)
{ {
if (item->generation < generationCounter) if (item->generation < generationCounter)
removeItem(item); removeItem(item);
else else {
foreach (WatchItem *child, item->children) foreach (WatchItem *child, item->children)
removeOutdatedHelper(child); removeOutdatedHelper(child);
item->fetchTriggered = false;
}
} }
void WatchModel::removeItem(WatchItem *item) void WatchModel::removeItem(WatchItem *item)
...@@ -479,15 +481,15 @@ QString niceType(QString type) ...@@ -479,15 +481,15 @@ QString niceType(QString type)
bool WatchModel::canFetchMore(const QModelIndex &index) const bool WatchModel::canFetchMore(const QModelIndex &index) const
{ {
return index.isValid() && !watchItem(index)->fetchedTriggered; return index.isValid() && !watchItem(index)->fetchTriggered;
} }
void WatchModel::fetchMore(const QModelIndex &index) void WatchModel::fetchMore(const QModelIndex &index)
{ {
QTC_ASSERT(index.isValid(), return); QTC_ASSERT(index.isValid(), return);
QTC_ASSERT(!watchItem(index)->fetchedTriggered, return); QTC_ASSERT(!watchItem(index)->fetchTriggered, return);
if (WatchItem *item = watchItem(index)) { if (WatchItem *item = watchItem(index)) {
item->fetchedTriggered = true; item->fetchTriggered = true;
WatchData data = *item; WatchData data = *item;
data.setChildrenNeeded(); data.setChildrenNeeded();
emit m_handler->watchDataUpdateNeeded(data); emit m_handler->watchDataUpdateNeeded(data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment