misc(misc): debugging stuff

This commit is contained in:
maelstrom 2025-08-23 01:56:46 +02:00
parent cba770c4af
commit 497cbc51e0
8 changed files with 18 additions and 14 deletions

7
.vscode/launch.json vendored
View file

@ -4,6 +4,13 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "launch",
"name": "Debug (gdb)",
"program": "${workspaceFolder}/build/bin/editor",
"cwd": "${workspaceFolder}",
},
{
"type": "lldb",
"request": "launch",

View file

@ -20,6 +20,12 @@ DataModel::DataModel()
this->name = "Place";
}
DataModel::~DataModel() {
#ifndef NDEBUG
printf("Datamodel successfully destroyed\n");
#endif
}
void DataModel::Init(bool runMode) {
// Create default services
GetService<Workspace>();

View file

@ -24,6 +24,7 @@ public:
std::optional<std::string> currentFile;
DataModel();
~DataModel();
void Init(bool runMode = false);
static inline std::shared_ptr<DataModel> New() { return std::make_shared<DataModel>(); };

View file

@ -1,13 +1,8 @@
#include "panic.h"
#include <cstdlib>
#include "logger.h"
#include "platform.h"
#ifdef _NDEBUG
#define NDEBUG
#endif
bool trySafeAbort = false;
void panic() {
// We've already been here, safe aborting has failed.

View file

@ -32,10 +32,6 @@
#include <qtoolbutton.h>
#include <vector>
#ifdef _NDEBUG
#define NDEBUG
#endif
bool worldSpaceTransforms = false;
inline bool isDarkMode() {

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1050</width>
<width>1100</width>
<height>750</height>
</rect>
</property>

View file

@ -8,10 +8,6 @@
#include <qmimedata.h>
#include <QWidget>
#ifdef _NDEBUG
#define NDEBUG
#endif
#define M_mainWindow dynamic_cast<MainWindow*>(dynamic_cast<QWidget*>(dynamic_cast<QObject*>(this)->parent())->window())
// https://doc.qt.io/qt-6/qtwidgets-itemviews-simpletreemodel-example.html#testing-the-model

View file

@ -55,6 +55,9 @@ void PlaceDocument::setRunState(RunState newState) {
} else if (newState == RUN_STOPPED) {
_runState = RUN_STOPPED;
#ifndef NDEBUG
printf("DataModel stopped. Remaning use counts (should be 1): %ld\n", gDataModel.use_count());
#endif
// TODO: GC: Check to make sure gDataModel gets properly garbage collected prior to this
gDataModel = editModeDataModel;
updateSelectionListeners(gDataModel->GetService<Selection>());