Skip to content

Commit

Permalink
1.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed May 29, 2023
1 parent 503f11c commit c54e6db
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- fixed Regression: DLL loading problem (Entry Point Not Found) [#2980](https://github.com/sandboxie-plus/Sandboxie/issues/2980)
- fixed [1.9.4/5] Sandboxie does not mark deleted files or registry keys while virtualization scheme v2 is active [#2984](https://github.com/sandboxie-plus/Sandboxie/issues/2984)
- fixed SandMan: Timestamp of the Sandboxie.ini [#2985](https://github.com/sandboxie-plus/Sandboxie/issues/2985)
- fixed [Plus UI] Crash after pressing the button "Show NT Object Tree" several times [#2943](https://github.com/sandboxie-plus/Sandboxie/issues/2943)



Expand Down
28 changes: 20 additions & 8 deletions SandboxiePlus/MiscHelpers/Common/TreeItemModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ void CTreeItemModel::RemoveIndex(const QModelIndex &index)
return;

STreeNode* pNode = static_cast<STreeNode*>(index.internalPointer());
ASSERT(pNode);
if (!m_Nodes.contains(pNode))
return;

QHash<QVariant, STreeNode*> Old;
Old[pNode->ID] = pNode;
Expand All @@ -367,7 +368,8 @@ bool CTreeItemModel::setData(const QModelIndex &index, const QVariant &value, in
if(index.column() == FIRST_COLUMN && role == Qt::CheckStateRole)
{
STreeNode* pNode = static_cast<STreeNode*>(index.internalPointer());
ASSERT(pNode);
if (!m_Nodes.contains(pNode))
return false;
emit CheckChanged(pNode->ID, value.toInt() != Qt::Unchecked);
return true;
}
Expand All @@ -380,7 +382,8 @@ QVariant CTreeItemModel::GetItemID(const QModelIndex& index) const
return QVariant();

STreeNode* pNode = static_cast<STreeNode*>(index.internalPointer());

if (!m_Nodes.contains(pNode))
return QVariant();
return pNode->ID;
}

Expand All @@ -393,7 +396,8 @@ QVariant CTreeItemModel::Data(const QModelIndex &index, int role, int section) c
// return QSize(64,16); // for fixing height

STreeNode* pNode = static_cast<STreeNode*>(index.internalPointer());
ASSERT(pNode);
if (!m_Nodes.contains(pNode))
return QVariant();

return NodeData(pNode, role, section);
}
Expand Down Expand Up @@ -496,8 +500,11 @@ QModelIndex CTreeItemModel::index(int row, int column, const QModelIndex &parent
STreeNode* pParent;
if (!parent.isValid())
pParent = m_Root;
else
pParent = static_cast<STreeNode*>(parent.internalPointer());
else {
pParent = static_cast<STreeNode*>(parent.internalPointer());
if (!m_Nodes.contains(pParent))
return QModelIndex();
}

if(STreeNode* pNode = pParent->Children.count() > row ? pParent->Children[row] : NULL)
return createIndex(row, column, pNode);
Expand All @@ -510,6 +517,8 @@ QModelIndex CTreeItemModel::parent(const QModelIndex &index) const
return QModelIndex();

STreeNode* pNode = static_cast<STreeNode*>(index.internalPointer());
if (!m_Nodes.contains(pNode))
return QModelIndex();
ASSERT(pNode->Parent);
STreeNode* pParent = pNode->Parent;
if (pParent == m_Root)
Expand All @@ -529,8 +538,11 @@ int CTreeItemModel::rowCount(const QModelIndex &parent) const
STreeNode* pNode;
if (!parent.isValid())
pNode = m_Root;
else
pNode = static_cast<STreeNode*>(parent.internalPointer());
else {
pNode = static_cast<STreeNode*>(parent.internalPointer());
if (!m_Nodes.contains(pNode))
return 0;
}
return pNode->Children.count();
}

Expand Down
13 changes: 10 additions & 3 deletions SandboxiePlus/MiscHelpers/Common/TreeItemModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public slots:
protected:
struct STreeNode
{
STreeNode(const QVariant& Id) {
STreeNode(CTreeItemModel* pModel, const QVariant& Id) {
ID = Id;
Parent = NULL;
Row = 0;
Expand All @@ -59,8 +59,13 @@ public slots:

IsBold = false;
IsGray = false;

Model = pModel;
Model->m_Nodes.insert(this);
}
virtual ~STreeNode(){
Model->m_Nodes.remove(this);
}
virtual ~STreeNode(){}

QVariant ID;

Expand All @@ -83,6 +88,7 @@ public slots:
QVariant Formatted;
};
QVector<SValue> Values;
CTreeItemModel* Model;
};

virtual QVariant NodeData(STreeNode* pNode, int role, int section) const;
Expand All @@ -105,6 +111,7 @@ public slots:

STreeNode* m_Root;
QHash<QVariant, STreeNode*> m_Map;
QSet<STreeNode*> m_Nodes;
bool m_bUseIcons;

static bool m_DarkMode;
Expand All @@ -129,7 +136,7 @@ class MISCHELPERS_EXPORT CSimpleTreeModel : public CTreeItemModel
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;

protected:
virtual STreeNode* MkNode(const QVariant& Id) { return new STreeNode(Id); }
virtual STreeNode* MkNode(const QVariant& Id) { return new STreeNode(this, Id); }
virtual void FreeNode(STreeNode* pNode) { delete pNode; }

QList<QVariant> MakePath(const QVariantMap& Cur, const QMap<QVariant, QVariantMap>& List);
Expand Down
4 changes: 2 additions & 2 deletions SandboxiePlus/SandMan/Models/MonitorModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ class CMonitorModel : public CTreeItemModel
protected:
struct STraceNode : STreeNode
{
STraceNode(const QVariant& Id) : STreeNode(Id) { }
STraceNode(CTreeItemModel* pModel, const QVariant& Id) : STreeNode(pModel, Id) { }

CMonitorEntryPtr pEntry;
};

virtual STreeNode* MkNode(const QVariant& Id) { return new STraceNode(Id); }
virtual STreeNode* MkNode(const QVariant& Id) { return new STraceNode(this, Id); }
virtual STreeNode* MkVirtualNode(const QVariant& Id, STreeNode* pParent);

bool m_bObjTree;
Expand Down
4 changes: 2 additions & 2 deletions SandboxiePlus/SandMan/Models/SbieModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CSbieModel : public CTreeItemModel

struct SSandBoxNode: STreeNode
{
SSandBoxNode(const QVariant& Id) : STreeNode(Id) { inUse = false; bOpen = false; busyState = 0; boxType = -1; boxDel = false; boxNoForce = false; boxColor = 0; OrderNumber = 0; }
SSandBoxNode(CTreeItemModel* pModel, const QVariant& Id) : STreeNode(pModel, Id) { inUse = false; bOpen = false; busyState = 0; boxType = -1; boxDel = false; boxNoForce = false; boxColor = 0; OrderNumber = 0; }

CSandBoxPtr pBox;
bool inUse;
Expand All @@ -85,7 +85,7 @@ class CSbieModel : public CTreeItemModel

virtual QVariant NodeData(STreeNode* pNode, int role, int section) const;

virtual STreeNode* MkNode(const QVariant& Id) { return new SSandBoxNode(Id); }
virtual STreeNode* MkNode(const QVariant& Id) { return new SSandBoxNode(this, Id); }

QList<QVariant> MakeProcPath(const QString& BoxName, const CBoxedProcessPtr& pProcess, const QMap<quint32, CBoxedProcessPtr>& ProcessList);
void MakeProcPath(const CBoxedProcessPtr& pProcess, const QMap<quint32, CBoxedProcessPtr>& ProcessList, QList<QVariant>& Path);
Expand Down

0 comments on commit c54e6db

Please sign in to comment.