summaryrefslogtreecommitdiff
path: root/view/sharedcache/ui
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2024-10-28 11:58:15 -0400
committerkat <kat@vector35.com>2024-10-28 12:58:51 -0400
commit07bce5f257d30061475452ec9c2e06a132747b54 (patch)
tree434dbd4660b981edd81c3f1651e868aacb240b26 /view/sharedcache/ui
parent891b8c0d4366266c0b9af08037dbd71c54cf86b3 (diff)
[SharedCache] Fix UI causing BV leaks
Diffstat (limited to 'view/sharedcache/ui')
-rw-r--r--view/sharedcache/ui/CMakeLists.txt6
-rw-r--r--view/sharedcache/ui/SharedCacheUINotifications.cpp16
-rw-r--r--view/sharedcache/ui/dscpicker.cpp4
-rw-r--r--view/sharedcache/ui/dsctriage.cpp7
-rw-r--r--view/sharedcache/ui/dsctriage.h9
-rw-r--r--view/sharedcache/ui/dscwidget.cpp2
-rw-r--r--view/sharedcache/ui/dscwidget.h2
7 files changed, 23 insertions, 23 deletions
diff --git a/view/sharedcache/ui/CMakeLists.txt b/view/sharedcache/ui/CMakeLists.txt
index 04e2f3cb..1695b8dd 100644
--- a/view/sharedcache/ui/CMakeLists.txt
+++ b/view/sharedcache/ui/CMakeLists.txt
@@ -13,7 +13,11 @@ list(FILTER SOURCES EXCLUDE REGEX qrc_.*)
add_library(sharedcacheui SHARED ${SOURCES})
if (VIEW_NAME)
- target_compile_definitions(sharedcacheui PRIVATE VIEW_NAME="${VIEW_NAME}")
+ if (BN_REF_COUNT_DEBUG)
+ target_compile_definitions(sharedcacheui PRIVATE VIEW_NAME="${VIEW_NAME}" BN_REF_COUNT_DEBUG)
+ else()
+ target_compile_definitions(sharedcacheui PRIVATE VIEW_NAME="${VIEW_NAME}")
+ endif()
else()
error("VIEW_NAME must be defined")
endif()
diff --git a/view/sharedcache/ui/SharedCacheUINotifications.cpp b/view/sharedcache/ui/SharedCacheUINotifications.cpp
index 6c64c9ef..6979bac3 100644
--- a/view/sharedcache/ui/SharedCacheUINotifications.cpp
+++ b/view/sharedcache/ui/SharedCacheUINotifications.cpp
@@ -48,11 +48,11 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q
if (!ah->isBoundAction("Load Image by Name"))
{
ah->bindAction("Load Image by Name", UIAction([view = view](const UIActionContext& ctx) {
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(view);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(view);
DisplayDSCPicker(ctx.context, view);
}));
ah->bindAction("Load Section by Address", UIAction([view = view](const UIActionContext& ctx) {
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
uint64_t addr = 0;
bool gotAddr = GetAddressInput(addr, "Address", "Address");
if (gotAddr)
@@ -67,7 +67,7 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q
UIAction(
[](const UIActionContext& ctx) {
Ref<BinaryView> view = ctx.binaryView;
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
uint64_t addr = ctx.token.token.value;
if (addr)
{
@@ -78,7 +78,7 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q
}
},
[](const UIActionContext& ctx) {
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
uint64_t addr = ctx.token.token.value;
if (isAddrMapped(ctx.binaryView, addr))
return false;
@@ -88,7 +88,7 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q
UIAction(
[](const UIActionContext& ctx) {
Ref<BinaryView> view = ctx.binaryView;
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(view);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(view);
uint64_t addr = ctx.token.token.value;
if (addr)
{
@@ -99,21 +99,21 @@ void UINotifications::OnViewChange(UIContext* context, ViewFrame* frame, const Q
}
},
[](const UIActionContext& ctx) {
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
uint64_t addr = ctx.token.token.value;
if (isAddrMapped(ctx.binaryView, addr))
return false;
return addr && cache->GetImageNameForAddress(addr) != ""; // bool
}));
ah->setActionDisplayName("Load ADDRHERE", [](const UIActionContext& ctx) {
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
uint64_t addr = ctx.token.token.value;
if (addr)
return QString("Load ") + cache->GetNameForAddress(addr).c_str();
return QString("Error");
});
ah->setActionDisplayName("Load IMGHERE", [](const UIActionContext& ctx) {
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(ctx.binaryView);
uint64_t addr = ctx.token.token.value;
if (addr)
return QString("Load ") + cache->GetImageNameForAddress(addr).c_str();
diff --git a/view/sharedcache/ui/dscpicker.cpp b/view/sharedcache/ui/dscpicker.cpp
index 33877675..a82da4fc 100644
--- a/view/sharedcache/ui/dscpicker.cpp
+++ b/view/sharedcache/ui/dscpicker.cpp
@@ -15,7 +15,7 @@ void DisplayDSCPicker(UIContext* ctx, Ref<BinaryView> dscView)
BackgroundThread::create(ctx ? ctx->mainWindow() : nullptr)->thenBackground(
[dscView=dscView](QVariant var) {
QStringList entries;
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(dscView);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(dscView);
for (const auto& img : cache->GetAvailableImages())
entries.push_back(QString::fromStdString(img));
@@ -36,7 +36,7 @@ void DisplayDSCPicker(UIContext* ctx, Ref<BinaryView> dscView)
})->thenBackground([dscView=dscView](QVariant var){
if (var.toString().isEmpty())
return;
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(dscView);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(dscView);
cache->LoadImageWithInstallName(var.toString().toStdString());
})->start();
}
diff --git a/view/sharedcache/ui/dsctriage.cpp b/view/sharedcache/ui/dsctriage.cpp
index 0dca96bf..6f931ee6 100644
--- a/view/sharedcache/ui/dsctriage.cpp
+++ b/view/sharedcache/ui/dsctriage.cpp
@@ -20,7 +20,7 @@
#define QSETTINGS_KEY_ALPHA_POPUP_SEEN "DSCTriage-AlphaPopupSeen"
-DSCCacheBlocksView::DSCCacheBlocksView(QWidget* parent, BinaryViewRef data, SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache)
+DSCCacheBlocksView::DSCCacheBlocksView(QWidget* parent, BinaryViewRef data, Ref<SharedCacheAPI::SharedCache> cache)
: QWidget(parent), m_data(data), m_cache(cache)
{
setMouseTracking(true);
@@ -477,7 +477,7 @@ void SymbolTableModel::setFilter(std::string text)
}
-SymbolTableView::SymbolTableView(QWidget* parent, SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache)
+SymbolTableView::SymbolTableView(QWidget* parent, Ref<SharedCacheAPI::SharedCache> cache)
: m_model(new SymbolTableModel(this)){
// Set up the filter model
@@ -865,9 +865,6 @@ Contributions are always welcome! </p>
}
-DSCTriageView::~DSCTriageView() {}
-
-
QFont DSCTriageView::getFont()
{
return getMonospaceFont(this);
diff --git a/view/sharedcache/ui/dsctriage.h b/view/sharedcache/ui/dsctriage.h
index 96099a53..a0460e63 100644
--- a/view/sharedcache/ui/dsctriage.h
+++ b/view/sharedcache/ui/dsctriage.h
@@ -24,7 +24,7 @@ class DSCCacheBlocksView : public QWidget
Q_OBJECT
BinaryViewRef m_data;
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> m_cache;
+ Ref<SharedCacheAPI::SharedCache> m_cache;
uint64_t m_backingCacheCount = 0;
std::vector<SharedCacheAPI::BackingCache> m_backingCaches;
@@ -45,7 +45,7 @@ class DSCCacheBlocksView : public QWidget
void blockSelected(int index);
public:
- DSCCacheBlocksView(QWidget* parent, BinaryViewRef data, SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache);
+ DSCCacheBlocksView(QWidget* parent, BinaryViewRef data, Ref<SharedCacheAPI::SharedCache> cache);
virtual ~DSCCacheBlocksView() override;
protected:
@@ -218,7 +218,7 @@ class SymbolTableView : public QTableView, public FilterTarget
SymbolTableModel* m_model;
public:
- SymbolTableView(QWidget* parent, SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> cache);
+ SymbolTableView(QWidget* parent, Ref<SharedCacheAPI::SharedCache> cache);
virtual ~SymbolTableView() override;
void scrollToFirstItem() override {
@@ -262,7 +262,7 @@ class DSCTriageView : public QWidget, public View
{
BinaryViewRef m_data;
QVBoxLayout* m_layout;
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> m_cache;
+ Ref<SharedCacheAPI::SharedCache> m_cache;
SplitTabWidget* m_triageTabs;
DockableTabCollection* m_triageCollection;
@@ -275,7 +275,6 @@ class DSCTriageView : public QWidget, public View
public:
DSCTriageView(QWidget* parent, BinaryViewRef data);
- virtual ~DSCTriageView() override;
BinaryViewRef getData() override;
void setSelectionOffsets(BNAddressRange range) override {};
QFont getFont() override;
diff --git a/view/sharedcache/ui/dscwidget.cpp b/view/sharedcache/ui/dscwidget.cpp
index 2483a26e..adece165 100644
--- a/view/sharedcache/ui/dscwidget.cpp
+++ b/view/sharedcache/ui/dscwidget.cpp
@@ -346,7 +346,7 @@ void DSCSidebarView::navigateToIndex(const QModelIndex& index)
if (reply == QMessageBox::Yes)
{
- SharedCacheAPI::SharedCache* cache = new SharedCacheAPI::SharedCache(m_data);
+ Ref<SharedCacheAPI::SharedCache> cache = new SharedCacheAPI::SharedCache(m_data);
cache->LoadImageWithInstallName(modelItem->m_installName);
m_data->UpdateAnalysis();
}
diff --git a/view/sharedcache/ui/dscwidget.h b/view/sharedcache/ui/dscwidget.h
index 0d5b9e0b..c4be969c 100644
--- a/view/sharedcache/ui/dscwidget.h
+++ b/view/sharedcache/ui/dscwidget.h
@@ -76,7 +76,7 @@ class DSCContentsModel : public QAbstractItemModel {
Q_OBJECT
BinaryViewRef m_bv;
- SharedCacheAPI::SCRef<SharedCacheAPI::SharedCache> m_cache;
+ Ref<SharedCacheAPI::SharedCache> m_cache;
DSCContentsModelItem *m_root;
std::unordered_map<std::string, DSCContentsModelItem *> m_dscItems;