citra_qt: Better debug widget lifetime
This commit is contained in:
parent
cf694f2350
commit
622ac9fca3
@ -19,7 +19,7 @@ int GPUCommandStreamItemModel::rowCount([[maybe_unused]] const QModelIndex& pare
|
||||
}
|
||||
|
||||
QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) const {
|
||||
if (!index.isValid())
|
||||
if (!index.isValid() || !GetDebugger())
|
||||
return QVariant();
|
||||
|
||||
int command_index = index.row();
|
||||
@ -74,16 +74,26 @@ GPUCommandStreamWidget::GPUCommandStreamWidget(Core::System& system_, QWidget* p
|
||||
setWidget(command_list);
|
||||
}
|
||||
|
||||
void GPUCommandStreamWidget::Register() {
|
||||
auto& debugger = system.GPU().Debugger();
|
||||
debugger.RegisterObserver(&model);
|
||||
}
|
||||
|
||||
void GPUCommandStreamWidget::Unregister() {
|
||||
auto& debugger = system.GPU().Debugger();
|
||||
debugger.UnregisterObserver(&model);
|
||||
}
|
||||
|
||||
void GPUCommandStreamWidget::showEvent(QShowEvent* event) {
|
||||
if (system.IsPoweredOn()) {
|
||||
system.GPU().Debugger().RegisterObserver(&model);
|
||||
Register();
|
||||
}
|
||||
QDockWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void GPUCommandStreamWidget::hideEvent(QHideEvent* event) {
|
||||
if (system.IsPoweredOn()) {
|
||||
system.GPU().Debugger().UnregisterObserver(&model);
|
||||
Unregister();
|
||||
}
|
||||
QDockWidget::hideEvent(event);
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ class GPUCommandStreamWidget : public QDockWidget {
|
||||
public:
|
||||
GPUCommandStreamWidget(Core::System& system, QWidget* parent = nullptr);
|
||||
|
||||
void Register();
|
||||
void Unregister();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void hideEvent(QHideEvent* event) override;
|
||||
|
@ -1237,6 +1237,11 @@ void GMainWindow::BootGame(const QString& filename) {
|
||||
video_dumping_path.clear();
|
||||
}
|
||||
|
||||
// Register debug widgets
|
||||
if (graphicsWidget->isVisible()) {
|
||||
graphicsWidget->Register();
|
||||
}
|
||||
|
||||
// Create and start the emulation thread
|
||||
emu_thread = std::make_unique<EmuThread>(system, *render_window);
|
||||
emit EmulationStarting(emu_thread.get());
|
||||
@ -1315,6 +1320,11 @@ void GMainWindow::ShutdownGame() {
|
||||
// TODO(bunnei): This function is not thread safe, but it's being used as if it were
|
||||
Pica::g_debug_context->ClearBreakpoints();
|
||||
|
||||
// Unregister debug widgets
|
||||
if (graphicsWidget->isVisible()) {
|
||||
graphicsWidget->Unregister();
|
||||
}
|
||||
|
||||
// Frame advancing must be cancelled in order to release the emu thread from waiting
|
||||
system.frame_limiter.SetFrameAdvancing(false);
|
||||
|
||||
|
@ -346,7 +346,7 @@ std::shared_ptr<PageTable> MemorySystem::GetCurrentPageTable() const {
|
||||
}
|
||||
|
||||
void RasterizerFlushVirtualRegion(VAddr start, u32 size, FlushMode mode) {
|
||||
VAddr end = start + size;
|
||||
const VAddr end = start + size;
|
||||
|
||||
auto CheckRegion = [&](VAddr region_start, VAddr region_end, PAddr paddr_region_start) {
|
||||
if (start >= region_end || end <= region_start) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user