From 507935f828188047ee009d2216a2c2d92c8b83fd Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Mon, 14 Apr 2025 11:15:01 -0400 Subject: Fixes for multiple issues in DSC/KC Triage views. 1. Crash on kernel cache image load 2. Duplicate Load Image buttons in kernel cache view 3. Improper selection behavior in both views 4. Address column should no longer resize to be smaller than contents 5. Symbol tables should now be properly sortable --- view/sharedcache/ui/symboltable.h | 47 ++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'view/sharedcache/ui/symboltable.h') diff --git a/view/sharedcache/ui/symboltable.h b/view/sharedcache/ui/symboltable.h index 2fc5c892..51ba88f0 100644 --- a/view/sharedcache/ui/symboltable.h +++ b/view/sharedcache/ui/symboltable.h @@ -2,12 +2,13 @@ #include #include "viewframe.h" -#include "animation.h" #include #include #include "filter.h" +#ifndef BINARYNINJA_DSCSYMBOLTABLE_H +#define BINARYNINJA_DSCSYMBOLTABLE_H class SymbolTableView; @@ -29,9 +30,11 @@ public: int columnCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + void sort(int column, Qt::SortOrder order) override; void updateSymbols(std::vector&& symbols); void setFilter(std::string text); const SharedCacheAPI::CacheSymbol& symbolAt(int row) const; + }; @@ -44,45 +47,46 @@ Q_OBJECT public: explicit SymbolTableView(QWidget* parent); - ~SymbolTableView() override; + // Call this to populate the symbols from the given view. + void populateSymbols(BinaryNinja::BinaryView& view); + void scrollToFirstItem() override { - if (model()->rowCount() > 0) - { - scrollTo(model()->index(0, 0)); + if (model()->rowCount() > 0) { + QModelIndex top = indexAt(rect().topLeft()); + if (top.isValid()) + scrollTo(top); } } - // Call this to populate the symbols from the given view. - void populateSymbols(BinaryNinja::BinaryView& view); - void scrollToCurrentItem() override { QModelIndex currentIndex = selectionModel()->currentIndex(); if (currentIndex.isValid()) - { scrollTo(currentIndex); - } } void selectFirstItem() override { - if (model()->rowCount() > 0) - { - QModelIndex firstIndex = model()->index(0, 0); - selectionModel()->select(firstIndex, QItemSelectionModel::ClearAndSelect); + if (model()->rowCount() > 0) { + QModelIndex top = indexAt(rect().topLeft()); + if (top.isValid()) { + selectionModel()->select(top, QItemSelectionModel::ClearAndSelect); + setCurrentIndex(top); + } } } void activateFirstItem() override { - if (model()->rowCount() > 0) - { - QModelIndex firstIndex = model()->index(0, 0); - setCurrentIndex(firstIndex); - emit activated(firstIndex); + if (model()->rowCount() > 0) { + QModelIndex topLeft = indexAt(rect().topLeft()); + if (topLeft.isValid()) { + setCurrentIndex(topLeft); + emit activated(topLeft); + } } } @@ -92,4 +96,7 @@ public: } void setFilter(const std::string& filter) override; -}; \ No newline at end of file +}; + + +#endif // BINARYNINJA_DSCSYMBOLTABLE_H -- cgit v1.3.1