mirror of
https://github.com/holub/mame
synced 2025-07-03 17:08:39 +03:00
Qt Debugger: The MAME memory tracking system no longer double-frees closed QT
windows. Also fixes the font segfault on exit again. (nw, but thanks Carl)
This commit is contained in:
parent
64fbe42028
commit
35704b5ad4
@ -11,6 +11,10 @@
|
|||||||
|
|
||||||
#if !defined(NO_DEBUGGER)
|
#if !defined(NO_DEBUGGER)
|
||||||
|
|
||||||
|
#define NO_MEM_TRACKING
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <QtGui/QtGui>
|
#include <QtGui/QtGui>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
|
||||||
@ -47,7 +51,7 @@ MainWindow* mainQtWindow = NULL;
|
|||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
// Global variable used to feed the xml configuration callbacks
|
// Global variable used to feed the xml configuration callbacks
|
||||||
simple_list<WindowQtConfig> xmlConfigurations;
|
std::vector<WindowQtConfig*> xmlConfigurations;
|
||||||
|
|
||||||
|
|
||||||
static void xml_configuration_load(running_machine &machine, int config_type, xml_data_node *parentnode)
|
static void xml_configuration_load(running_machine &machine, int config_type, xml_data_node *parentnode)
|
||||||
@ -60,23 +64,24 @@ static void xml_configuration_load(running_machine &machine, int config_type, xm
|
|||||||
if (parentnode == NULL)
|
if (parentnode == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xmlConfigurations.reset();
|
for (int i = 0; i < xmlConfigurations.size(); i++)
|
||||||
|
delete xmlConfigurations[i];
|
||||||
|
xmlConfigurations.clear();
|
||||||
|
|
||||||
// Configuration load
|
// Configuration load
|
||||||
xml_data_node* wnode = NULL;
|
xml_data_node* wnode = NULL;
|
||||||
for (wnode = xml_get_sibling(parentnode->child, "window"); wnode != NULL; wnode = xml_get_sibling(wnode->next, "window"))
|
for (wnode = xml_get_sibling(parentnode->child, "window"); wnode != NULL; wnode = xml_get_sibling(wnode->next, "window"))
|
||||||
{
|
{
|
||||||
WindowQtConfig* config = NULL;
|
|
||||||
WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", WindowQtConfig::WIN_TYPE_UNKNOWN);
|
WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", WindowQtConfig::WIN_TYPE_UNKNOWN);
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case WindowQtConfig::WIN_TYPE_MAIN: config = &xmlConfigurations.append(*global_alloc(MainWindowQtConfig)); break;
|
case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(new MainWindowQtConfig()); break;
|
||||||
case WindowQtConfig::WIN_TYPE_MEMORY: config = &xmlConfigurations.append(*global_alloc(MemoryWindowQtConfig)); break;
|
case WindowQtConfig::WIN_TYPE_MEMORY: xmlConfigurations.push_back(new MemoryWindowQtConfig()); break;
|
||||||
case WindowQtConfig::WIN_TYPE_DASM: config = &xmlConfigurations.append(*global_alloc(DasmWindowQtConfig)); break;
|
case WindowQtConfig::WIN_TYPE_DASM: xmlConfigurations.push_back(new DasmWindowQtConfig()); break;
|
||||||
case WindowQtConfig::WIN_TYPE_LOG: config = &xmlConfigurations.append(*global_alloc(LogWindowQtConfig)); break;
|
case WindowQtConfig::WIN_TYPE_LOG: xmlConfigurations.push_back(new LogWindowQtConfig()); break;
|
||||||
default: break;
|
default: continue;
|
||||||
}
|
}
|
||||||
config->recoverFromXmlNode(wnode);
|
xmlConfigurations.back()->recoverFromXmlNode(wnode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +92,10 @@ static void xml_configuration_save(running_machine &machine, int config_type, xm
|
|||||||
if (config_type != CONFIG_TYPE_GAME)
|
if (config_type != CONFIG_TYPE_GAME)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (WindowQtConfig* config = xmlConfigurations.first(); config != NULL; config = config->next())
|
for (int i = 0; i < xmlConfigurations.size(); i++)
|
||||||
{
|
{
|
||||||
|
WindowQtConfig* config = xmlConfigurations[i];
|
||||||
|
|
||||||
// Create an xml node
|
// Create an xml node
|
||||||
xml_data_node *debugger_node;
|
xml_data_node *debugger_node;
|
||||||
debugger_node = xml_add_child(parentnode, "window", NULL);
|
debugger_node = xml_add_child(parentnode, "window", NULL);
|
||||||
@ -103,7 +110,9 @@ static void xml_configuration_save(running_machine &machine, int config_type, xm
|
|||||||
|
|
||||||
static void gather_save_configurations()
|
static void gather_save_configurations()
|
||||||
{
|
{
|
||||||
xmlConfigurations.reset();
|
for (int i = 0; i < xmlConfigurations.size(); i++)
|
||||||
|
delete xmlConfigurations[i];
|
||||||
|
xmlConfigurations.clear();
|
||||||
|
|
||||||
// Loop over all the open windows
|
// Loop over all the open windows
|
||||||
foreach (QWidget* widget, QApplication::topLevelWidgets())
|
foreach (QWidget* widget, QApplication::topLevelWidgets())
|
||||||
@ -115,17 +124,16 @@ static void gather_save_configurations()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Figure out its type
|
// Figure out its type
|
||||||
WindowQtConfig* config = NULL;
|
|
||||||
if (dynamic_cast<MainWindow*>(widget))
|
if (dynamic_cast<MainWindow*>(widget))
|
||||||
config = &xmlConfigurations.append(*global_alloc(MainWindowQtConfig));
|
xmlConfigurations.push_back(new MainWindowQtConfig());
|
||||||
else if (dynamic_cast<MemoryWindow*>(widget))
|
else if (dynamic_cast<MemoryWindow*>(widget))
|
||||||
config = &xmlConfigurations.append(*global_alloc(MemoryWindowQtConfig));
|
xmlConfigurations.push_back(new MemoryWindowQtConfig());
|
||||||
else if (dynamic_cast<DasmWindow*>(widget))
|
else if (dynamic_cast<DasmWindow*>(widget))
|
||||||
config = &xmlConfigurations.append(*global_alloc(DasmWindowQtConfig));
|
xmlConfigurations.push_back(new DasmWindowQtConfig());
|
||||||
else if (dynamic_cast<LogWindow*>(widget))
|
else if (dynamic_cast<LogWindow*>(widget))
|
||||||
config = &xmlConfigurations.append(*global_alloc(LogWindowQtConfig));
|
xmlConfigurations.push_back(new LogWindowQtConfig());
|
||||||
|
|
||||||
config->buildFromQWidget(widget);
|
xmlConfigurations.back()->buildFromQWidget(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,24 +142,27 @@ static void gather_save_configurations()
|
|||||||
// Utilities
|
// Utilities
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
static void load_and_clear_main_window_config(simple_list<WindowQtConfig>& configList)
|
static void load_and_clear_main_window_config(std::vector<WindowQtConfig*>& configList)
|
||||||
{
|
{
|
||||||
for (WindowQtConfig* config = xmlConfigurations.first(); config != NULL; config = config->next())
|
for (int i = 0; i < configList.size(); i++)
|
||||||
{
|
{
|
||||||
|
WindowQtConfig* config = configList[i];
|
||||||
if (config->m_type == WindowQtConfig::WIN_TYPE_MAIN)
|
if (config->m_type == WindowQtConfig::WIN_TYPE_MAIN)
|
||||||
{
|
{
|
||||||
config->applyToQWidget(mainQtWindow);
|
config->applyToQWidget(mainQtWindow);
|
||||||
configList.remove(*config);
|
configList.erase(configList.begin()+i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void setup_additional_startup_windows(running_machine& machine, simple_list<WindowQtConfig>& configList)
|
static void setup_additional_startup_windows(running_machine& machine, std::vector<WindowQtConfig*>& configList)
|
||||||
{
|
{
|
||||||
for (WindowQtConfig* config = xmlConfigurations.first(); config != NULL; config = config->next())
|
for (int i = 0; i < configList.size(); i++)
|
||||||
{
|
{
|
||||||
|
WindowQtConfig* config = configList[i];
|
||||||
|
|
||||||
WindowQt* foo = NULL;
|
WindowQt* foo = NULL;
|
||||||
switch (config->m_type)
|
switch (config->m_type)
|
||||||
{
|
{
|
||||||
@ -222,7 +233,7 @@ extern int sdl_entered_debugger;
|
|||||||
|
|
||||||
void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
|
void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
|
||||||
{
|
{
|
||||||
#if defined(SDL)
|
#ifdef SDLMAME_UNIX
|
||||||
sdl_entered_debugger = 1;
|
sdl_entered_debugger = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#define NO_MEM_TRACKING
|
||||||
|
|
||||||
#include "debugqtdasmwindow.h"
|
#include "debugqtdasmwindow.h"
|
||||||
|
|
||||||
#include "debug/debugcon.h"
|
#include "debug/debugcon.h"
|
||||||
@ -102,6 +104,11 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DasmWindow::~DasmWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DasmWindow::cpuChanged(int index)
|
void DasmWindow::cpuChanged(int index)
|
||||||
{
|
{
|
||||||
m_dasmView->view()->set_source(*m_dasmView->view()->source_list().by_index(index));
|
m_dasmView->view()->set_source(*m_dasmView->view()->source_list().by_index(index));
|
||||||
|
@ -16,7 +16,7 @@ class DasmWindow : public WindowQt
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DasmWindow(running_machine* machine, QWidget* parent=NULL);
|
DasmWindow(running_machine* machine, QWidget* parent=NULL);
|
||||||
virtual ~DasmWindow() {}
|
virtual ~DasmWindow();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#define NO_MEM_TRACKING
|
||||||
|
|
||||||
#include "debugqtlogwindow.h"
|
#include "debugqtlogwindow.h"
|
||||||
|
|
||||||
#include "debug/debugcon.h"
|
#include "debug/debugcon.h"
|
||||||
@ -36,6 +38,11 @@ LogWindow::LogWindow(running_machine* machine, QWidget* parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LogWindow::~LogWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// LogWindowQtConfig
|
// LogWindowQtConfig
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
@ -16,7 +16,7 @@ class LogWindow : public WindowQt
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
LogWindow(running_machine* machine, QWidget* parent=NULL);
|
LogWindow(running_machine* machine, QWidget* parent=NULL);
|
||||||
virtual ~LogWindow() {}
|
virtual ~LogWindow();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
#define NO_MEM_TRACKING
|
||||||
|
|
||||||
#include "debugqtmainwindow.h"
|
#include "debugqtmainwindow.h"
|
||||||
|
|
||||||
#include "debug/debugcon.h"
|
#include "debug/debugcon.h"
|
||||||
#include "debug/debugcpu.h"
|
#include "debug/debugcpu.h"
|
||||||
#include "debug/dvdisasm.h"
|
#include "debug/dvdisasm.h"
|
||||||
@ -112,6 +115,11 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::setProcessor(device_t* processor)
|
void MainWindow::setProcessor(device_t* processor)
|
||||||
{
|
{
|
||||||
// Cpu swap
|
// Cpu swap
|
||||||
|
@ -22,7 +22,7 @@ class MainWindow : public WindowQt
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(running_machine* machine, QWidget* parent=NULL);
|
MainWindow(running_machine* machine, QWidget* parent=NULL);
|
||||||
virtual ~MainWindow() {}
|
virtual ~MainWindow();
|
||||||
|
|
||||||
void setProcessor(device_t* processor);
|
void setProcessor(device_t* processor);
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#define NO_MEM_TRACKING
|
||||||
|
|
||||||
#include "debugqtmemorywindow.h"
|
#include "debugqtmemorywindow.h"
|
||||||
|
|
||||||
#include "debug/dvmemory.h"
|
#include "debug/dvmemory.h"
|
||||||
@ -127,6 +129,11 @@ MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MemoryWindow::~MemoryWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MemoryWindow::memoryRegionChanged(int index)
|
void MemoryWindow::memoryRegionChanged(int index)
|
||||||
{
|
{
|
||||||
m_memTable->view()->set_source(*m_memTable->view()->source_list().by_index(index));
|
m_memTable->view()->set_source(*m_memTable->view()->source_list().by_index(index));
|
||||||
|
@ -18,7 +18,7 @@ class MemoryWindow : public WindowQt
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
MemoryWindow(running_machine* machine, QWidget* parent=NULL);
|
MemoryWindow(running_machine* machine, QWidget* parent=NULL);
|
||||||
virtual ~MemoryWindow() {}
|
virtual ~MemoryWindow();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <QtGui/QtGui>
|
#define NO_MEM_TRACKING
|
||||||
|
|
||||||
#include "debugqtview.h"
|
#include "debugqtview.h"
|
||||||
|
|
||||||
@ -214,6 +214,9 @@ void DebuggerView::keyPressEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
void DebuggerView::mousePressEvent(QMouseEvent* event)
|
void DebuggerView::mousePressEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
|
if (m_view == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
QFontMetrics actualFont = fontMetrics();
|
QFontMetrics actualFont = fontMetrics();
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
#include <QtGui/QtGui>
|
#define NO_MEM_TRACKING
|
||||||
|
|
||||||
#include "emu.h"
|
|
||||||
#include "debugger.h"
|
|
||||||
|
|
||||||
#include "debugqtwindow.h"
|
#include "debugqtwindow.h"
|
||||||
#include "debugqtlogwindow.h"
|
#include "debugqtlogwindow.h"
|
||||||
@ -108,6 +105,10 @@ WindowQt::WindowQt(running_machine* machine, QWidget* parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WindowQt::~WindowQt()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void WindowQt::debugActOpenMemory()
|
void WindowQt::debugActOpenMemory()
|
||||||
{
|
{
|
||||||
MemoryWindow* foo = new MemoryWindow(m_machine, this);
|
MemoryWindow* foo = new MemoryWindow(m_machine, this);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "debugger.h"
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
@ -16,7 +17,7 @@ class WindowQt : public QMainWindow
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
WindowQt(running_machine* machine, QWidget* parent=NULL);
|
WindowQt(running_machine* machine, QWidget* parent=NULL);
|
||||||
virtual ~WindowQt() {}
|
virtual ~WindowQt();
|
||||||
|
|
||||||
// The interface to an all-window refresh
|
// The interface to an all-window refresh
|
||||||
void refreshAll() { s_refreshAll = true; }
|
void refreshAll() { s_refreshAll = true; }
|
||||||
|
Loading…
Reference in New Issue
Block a user