Mercurial > hg > octave-terminal
changeset 13458:16d26344c2a2
Added semaphore to ensure that the workspace view will not get updated twice at a time.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sun, 17 Apr 2011 09:22:04 +0200 |
parents | aa1d4754edc3 |
children | 6b66ab238c26 |
files | gui//src/VariablesDockWidget.cpp gui//src/VariablesDockWidget.h |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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<SymbolRecord> symbolTable) { - + m_updateSemaphore->acquire(); // Split the symbol table into its different scopes. QList<SymbolRecord> localSymbolTable; QList<SymbolRecord> globalSymbolTable; @@ -82,6 +83,7 @@ updateScope(1, globalSymbolTable); updateScope(2, persistentSymbolTable); updateScope(3, hiddenSymbolTable); + m_updateSemaphore->release(); } void VariablesDockWidget::updateScope(int topLevelItemIndex, QList<SymbolRecord> symbolTable) {
--- a/gui//src/VariablesDockWidget.h +++ b/gui//src/VariablesDockWidget.h @@ -3,6 +3,7 @@ #include <QDockWidget> #include <QTreeWidget> +#include <QSemaphore> #include "OctaveLink.h" class VariablesDockWidget : public QDockWidget @@ -16,6 +17,7 @@ void updateTreeEntry(QTreeWidgetItem *treeItem, SymbolRecord symbolRecord); void updateScope(int topLevelItemIndex, QList<SymbolRecord> symbolTable); QTreeWidget *m_variablesTreeWidget; + QSemaphore *m_updateSemaphore; }; #endif // VARIABLESDOCKWIDGET_H