Skip to content

Commit c28b184

Browse files
committed
Fix app quit
1 parent 2631668 commit c28b184

31 files changed

+133
-3637
lines changed

libs/amDebugger/src/amDebugger/codeAnalyzer/copperDisasm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace amD {
99
struct DecodedCopperList {
1010
struct CopInst {
1111
AddrRef addr = 0;
12-
uint16_t w1 = -1;
13-
uint16_t w2 = -1;
12+
uint16_t w1 = ~0u;
13+
uint16_t w2 = ~0u;
1414
};
1515

1616
struct Entry : public CopInst {

libs/amDebugger/src/amDebugger/codeAnalyzer/quadTreeAddrMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class QuadTreeAddrMap
1414
struct Node {
1515
Node* m_children[4] = {nullptr, nullptr, nullptr, nullptr};
1616
TItem m_item = {};
17-
uint16_t m_idx = -1;
17+
uint16_t m_idx = ~0u;
1818
public:
1919
Node()
2020
{}

libs/amDebugger/src/amDebugger/debuggerApp.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,17 @@ amD::DebuggerApp* DebuggerApp::get() {
119119

120120

121121
void DebuggerApp::destroy() {
122-
if (m_pGui)
123-
m_pGui->destroy();
124122
if (m_pOperationMgr)
125123
m_pOperationMgr->destroy();
126124
m_pOperationMgr = nullptr;
127125

128-
// Cleanup
129-
ImGui_ImplSDLRenderer2_Shutdown();
130-
ImGui_ImplSDL2_Shutdown();
131-
ImGui::DestroyContext();
132-
133-
delete m_pGui;
126+
if (m_pGui)
127+
m_pGui->destroy();
134128
m_pGui = nullptr;
129+
135130
IVm::VM::destrotVmInst();
136131

132+
SAFE_DESTROY(m_pQimGuiCtx);
137133
SDL_DestroyRenderer(m_pWndRenderer);
138134
m_pWndRenderer = nullptr;
139135
SDL_DestroyWindow(m_pWindow);

libs/amDebugger/src/amDebugger/debuggerApp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class DebuggerApp : public qd::ApplicationPart, public qd::IOperationEnvironment
4949
public:
5050

5151
ref_ptr<amD::Debugger> m_pDebugger = nullptr; // current debugger client
52-
amD::DebuggerDesktop* m_pGui = nullptr;
52+
ref_ptr<amD::DebuggerDesktop> m_pGui;
5353
qd::OperationsRegistry* m_pOperationMgr = nullptr;
5454

5555
public:
@@ -85,7 +85,7 @@ class DebuggerApp : public qd::ApplicationPart, public qd::IOperationEnvironment
8585
private:
8686
void createRenderWindow();
8787
void initImGui();
88-
~DebuggerApp();
88+
virtual ~DebuggerApp() override;
8989

9090
}; // class DebuggerApp
9191
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

libs/amDebugger/src/amDebugger/exprValue.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ class AmDbgEvaluator : public ExprEvaluator
6666
: ExprEvaluator(0)
6767
{}
6868

69-
uint8_t memByte(ExprValue address) const { return address + 0x10; }
70-
uint16_t memWord(ExprValue address) const { return address - 0xb0; }
71-
uint32_t memDword(ExprValue address) const { return address * 4; }
69+
virtual uint8_t memByte(ExprValue address) const override { return uint8_t(address + 0x10); }
70+
virtual uint16_t memWord(ExprValue address) const override { return uint16_t(address - 0xb0); }
71+
virtual uint32_t memDword(ExprValue address) const override { return uint32_t(address * 4); }
7272
};
7373

7474
void ExprValStr::parse()

libs/amDebugger/src/amDebugger/ui/debuggerDesktop.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ void DebuggerDesktop::_drawMainMenuBar()
9696
// Windows
9797
if (auto pEm = qIm::LockMenu("Window"))
9898
{
99-
for (qd::UiNode* pCurWnd : m_pWindows)
99+
for (int i = 0; i < getNumChild(); ++i)
100100
{
101+
qd::UiNode* pCurWnd = getChild(i);
101102
if (!pCurWnd)
102103
continue;
103104
bool bVis = pCurWnd->isVisible();
@@ -115,13 +116,12 @@ void DebuggerDesktop::onNodeCreated(qd::UiNodeCreator* mk)
115116
{
116117
TSuper::onNodeCreated(mk);
117118

118-
m_pWindows.resize((size_t)WndId::MostCommonCount);
119119
m_pOperationMgr = &qd::OperationsRegistry::get(); // createComp_<qd::UiOperationMgrComp>()->m_pOpMgr;
120120
m_pShortcutMgr = qd::ShortcutsMgr::get(); // createComp_<qd::UiShortcutsMgrComp>();
121121
m_pShortcutMgr->createPredefinedShortcuts(
122122
eastl::span(&amD::shortcut::g_shortcuts_list[0], (size_t)amD::shortcut::EId::MAX_COUNT));
123123

124-
// create all m_pWindows
124+
// create all m_pChilds
125125
createAllUiWndows();
126126

127127
amD::operation::AmDebuggerOperationCreator operationCreate;
@@ -147,14 +147,18 @@ void DebuggerDesktop::createAllUiWndows()
147147
UiViewCreateCtx cv(this);
148148
amD::AmDbgWindow* pCurWnd = pCreateAttr->makeInstance_<amD::AmDbgWindow>(cv);
149149
assert(pCurWnd);
150-
addWindowNode(pCurWnd);
150+
addChild(pCurWnd);
151151
}
152152
}
153153

154+
void DebuggerDesktop::destroy()
155+
{
156+
TSuper::destroy();
157+
}
158+
154159

155160
DebuggerDesktop::~DebuggerDesktop()
156161
{
157-
assert(m_pWindows.empty());
158162
}
159163

160164

@@ -266,10 +270,5 @@ void DebuggerDesktop::_drawToolBar()
266270

267271

268272

269-
void DebuggerDesktop::destroy()
270-
{
271-
TSuper::destroy();
272-
}
273-
274273

275274
}; // namespace amD

libs/amDebugger/src/amDebugger/vm/customRegs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ amD::CustomFlagsDesc& CustomFlagsDesc::addBit(const char* p_name, uint8_t bits_c
8585
cb.name = p_name;
8686
cb.shiftL = shift_l;
8787
cb.mask = (1u << bits_count) - 1u;
88-
cb.noBeg = nextNo;
89-
cb.noEnd = nextNo + bits_count;
88+
cb.noBeg = (uint8_t)nextNo;
89+
cb.noEnd = (uint8_t)(nextNo + bits_count);
9090
cb.description = p_desc;
9191
return *this;
9292
}

libs/qd/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ add_source_group("app")
2525
add_source_group("math")
2626
add_source_group("mem")
2727
add_source_group("file")
28-
add_source_group("net")
2928
add_source_group("debug")
3029
add_source_group("enum")
3130
add_source_group("platform")

libs/qd/app/appPartsMgr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ void AppPartsManager::destroy()
149149
}
150150
c_def(0);
151151
}
152+
m_pParts.clear();
152153
}
153154

154155

libs/qd/app/application.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Application::~Application()
2929
void Application::destroy()
3030
{
3131
destroyImp();
32-
m_pAppParts->destroy();
32+
SAFE_DESTROY(m_pAppParts);
3333
}
3434

3535

0 commit comments

Comments
 (0)