# HG changeset patch # User Jacob Dawid # Date 1303024924 -7200 # Node ID 16d26344c2a29d77bf4b19d0237e2f727fb56f41 # Parent aa1d4754edc34417e3efe191c1d8e9e3063cf17a Added semaphore to ensure that the workspace view will not get updated twice at a time. diff --git a/gui//src/VariablesDockWidget.cpp b/gui//src/VariablesDockWidget.cpp --- a/gui//src/VariablesDockWidget.cpp +++ b/gui//src/VariablesDockWidget.cpp @@ -8,6 +8,7 @@ } void VariablesDockWidget::construct() { + m_updateSemaphore = new QSemaphore(1); QStringList headerLabels; headerLabels << "Name" << "Type" << "Value"; m_variablesTreeWidget = new QTreeWidget(this); @@ -51,7 +52,7 @@ } void VariablesDockWidget::setVariablesList(QList symbolTable) { - + m_updateSemaphore->acquire(); // Split the symbol table into its different scopes. QList localSymbolTable; QList globalSymbolTable; @@ -82,6 +83,7 @@ updateScope(1, globalSymbolTable); updateScope(2, persistentSymbolTable); updateScope(3, hiddenSymbolTable); + m_updateSemaphore->release(); } void VariablesDockWidget::updateScope(int topLevelItemIndex, QList symbolTable) { diff --git a/gui//src/VariablesDockWidget.h b/gui//src/VariablesDockWidget.h --- a/gui//src/VariablesDockWidget.h +++ b/gui//src/VariablesDockWidget.h @@ -3,6 +3,7 @@ #include #include +#include #include "OctaveLink.h" class VariablesDockWidget : public QDockWidget @@ -16,6 +17,7 @@ void updateTreeEntry(QTreeWidgetItem *treeItem, SymbolRecord symbolRecord); void updateScope(int topLevelItemIndex, QList symbolTable); QTreeWidget *m_variablesTreeWidget; + QSemaphore *m_updateSemaphore; }; #endif // VARIABLESDOCKWIDGET_H