summaryrefslogtreecommitdiffstats
path: root/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-02-04 14:40:29 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-02-04 14:54:28 (GMT)
commit17ba81e9587f3202363b42f6662a2866506e9247 (patch)
tree9014a42b7a3f96d3d21b81830bf9539f6a338549 /src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp
parent79766609a5c988174599882a9f3124f3fa8dfc1c (diff)
downloadQt-17ba81e9587f3202363b42f6662a2866506e9247.zip
Qt-17ba81e9587f3202363b42f6662a2866506e9247.tar.gz
Qt-17ba81e9587f3202363b42f6662a2866506e9247.tar.bz2
Fix QtScript debugger hang/crash issue with updating locals model
Since the model is updated lazily, it's possible that a new model has been set on the view (and the old model deleted) before the old model has finished refreshing. This was discovered while holding down the F11 key (Step Into) when debugging plasma.js in the script/context2d example, which causes many events (and hence asynchronous model updates) to trigger rapidly.
Diffstat (limited to 'src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp')
-rw-r--r--src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp b/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp
index 516a200..bbced5f 100644
--- a/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp
@@ -70,6 +70,8 @@ public:
bool hasChildren(const QModelIndex &parent) const
{
+ if (!sourceModel())
+ return false;
QModelIndex sourceParent = mapToSource(parent);
if (parent.isValid() && !sourceParent.isValid())
return false;
@@ -184,7 +186,8 @@ void QScriptDebuggerLocalsWidgetPrivate::_q_insertCompletion(const QString &text
void QScriptDebuggerLocalsWidgetPrivate::_q_expandIndex(const QModelIndex &index)
{
- view->expand(proxy->mapFromSource(index));
+ if (view->model() == index.model())
+ view->expand(proxy->mapFromSource(index));
}
class QScriptDebuggerLocalsItemDelegate