Skip to content

Commit bc2bf95

Browse files
re2zerodeepin-bot[bot]
authored andcommitted
fix: Fix segment error if menu quit
Force exit when quit from menu. Log: Fix segment error if menu quit.
1 parent 049b45b commit bc2bf95

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/qml/AlbumTitle.qml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ TitleBar {
4040
signal collectionBtnClicked(int nIndex)
4141
signal showHideSideBar(bool bShow)
4242
signal showNewAlbumDialog()
43+
signal forceExit()
4344

4445
property int minSearchEditWidth : 100 //搜索框最小尺寸
4546
property int normalSearchEditWidth : 240 //搜索框最大尺寸
@@ -135,7 +136,11 @@ TitleBar {
135136
license: qsTr("%1 is released under %2").arg(productName).arg("GPLV3")
136137
}
137138
}
138-
QuitAction { }
139+
QuitAction {
140+
onTriggered: {
141+
forceExit();
142+
}
143+
}
139144
}
140145
ActionButton {
141146
id: appTitleIcon

src/qml/main.qml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ ApplicationWindow {
2727
DWindow.enabled: true
2828
DWindow.alphaBufferSize: 8
2929
title: ""
30-
header: AlbumTitle {id: titleAlubmRect}
30+
header: AlbumTitle {
31+
id: titleAlubmRect
32+
33+
onForceExit: {
34+
saveAndTerminate()
35+
}
36+
}
3137

3238
background: Rectangle {
3339
anchors.fill: parent
@@ -116,9 +122,7 @@ ApplicationWindow {
116122

117123
//关闭的时候保存信息
118124
onClosing: {
119-
FileControl.saveSetting()
120-
FileControl.terminateShortcutPanelProcess() //结束快捷键面板进程
121-
GControl.forceExit();
125+
saveAndTerminate()
122126
}
123127

124128
FileDialog {
@@ -156,4 +160,11 @@ ApplicationWindow {
156160

157161
target: GControl
158162
}
163+
164+
// 保存并退出程序
165+
function saveAndTerminate() {
166+
FileControl.saveSetting()
167+
FileControl.terminateShortcutPanelProcess() //结束快捷键面板进程
168+
GControl.forceExit();
169+
}
159170
}

0 commit comments

Comments
 (0)