- fix: crash when project name is selected in the project view and try create new project file

This commit is contained in:
Roy Qu 2022-05-19 17:57:31 +08:00
parent 106bf4281a
commit c3db151c2c
5 changed files with 36 additions and 20 deletions

12
NEWS.md
View File

@ -1,3 +1,10 @@
Red Panda C++ Version 1.0.9
- fix: selection in column mode not correctly drawn when has wide chars in it
- fix: delete & insert in column mode not correctly handled
- fix: input with ime in column mode not correctly handled
- fix: copy & paste in column mode not correctly handled
- fix: crash when project name is selected in the project view and try create new project file
Red Panda C++ Version 1.0.8 Red Panda C++ Version 1.0.8
- enhancement: auto complete '#undef' - enhancement: auto complete '#undef'
- enhancement: redesign components for compiler commandline arguments processing - enhancement: redesign components for compiler commandline arguments processing
@ -9,11 +16,6 @@ Red Panda C++ Version 1.0.8
- enhancement: adjust scheme colors for "dark" and "high contrast" themes - enhancement: adjust scheme colors for "dark" and "high contrast" themes
- enhancement: can debug files that has non-ascii chars in its path and is compiled by clang - enhancement: can debug files that has non-ascii chars in its path and is compiled by clang
- fix: when debugging project, default compiler set is wrongly used - fix: when debugging project, default compiler set is wrongly used
- fix: selection in column mode not correctly drawn when has wide chars in it
- fix: delete & insert in column mode not correctly handled
- fix: input with ime in column mode not correctly handled
- fix: copy & paste in column mode not correctly handled
Red Panda C++ Version 1.0.7 Red Panda C++ Version 1.0.7
- change: use Shift+Enter to break line - change: use Shift+Enter to break line

View File

@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
} }
isEmpty(APP_VERSION) { isEmpty(APP_VERSION) {
APP_VERSION=1.0.8 APP_VERSION=1.0.9
} }

View File

@ -6029,7 +6029,16 @@ void MainWindow::newProjectUnitFile()
while (modelTypeNode && modelTypeNode->folderNodeType==ProjectSpecialFolderNode::NonSpecial) { while (modelTypeNode && modelTypeNode->folderNodeType==ProjectSpecialFolderNode::NonSpecial) {
modelTypeNode=modelTypeNode->parent.lock(); modelTypeNode=modelTypeNode->parent.lock();
} }
if (!modelTypeNode) {
modelTypeNode = mProject->rootNode();
}
NewProjectUnitDialog newProjectUnitDialog; NewProjectUnitDialog newProjectUnitDialog;
if (modelTypeNode == mProject->rootNode()) {
if (mProject->options().isCpp)
newProjectUnitDialog.setSuffix("cpp");
else
newProjectUnitDialog.setSuffix("c");
} else {
switch (modelTypeNode->folderNodeType) { switch (modelTypeNode->folderNodeType) {
case ProjectSpecialFolderNode::HEADERS: case ProjectSpecialFolderNode::HEADERS:
newProjectUnitDialog.setSuffix("h"); newProjectUnitDialog.setSuffix("h");
@ -6043,8 +6052,9 @@ void MainWindow::newProjectUnitFile()
default: default:
newProjectUnitDialog.setSuffix(""); newProjectUnitDialog.setSuffix("");
} }
}
QString folder = mProject->fileSystemNodeFolderPath(pNode); QString folder = mProject->fileSystemNodeFolderPath(pNode);
qDebug()<<folder; // qDebug()<<folder;
newProjectUnitDialog.setFolder(folder); newProjectUnitDialog.setFolder(folder);
if (newProjectUnitDialog.exec()!=QDialog::Accepted) { if (newProjectUnitDialog.exec()!=QDialog::Accepted) {
return; return;

View File

@ -752,6 +752,8 @@ void Project::updateNodeIndexes()
PProjectModelNode Project::pointerToNode(ProjectModelNode *p, PProjectModelNode parent) PProjectModelNode Project::pointerToNode(ProjectModelNode *p, PProjectModelNode parent)
{ {
if (!p)
return PProjectModelNode();
if (!parent) { if (!parent) {
parent = mRootNode; parent = mRootNode;
} }
@ -1797,11 +1799,13 @@ QFileSystemWatcher *Project::fileSystemWatcher() const
QString Project::fileSystemNodeFolderPath(const PProjectModelNode &node) QString Project::fileSystemNodeFolderPath(const PProjectModelNode &node)
{ {
QString result; QString result;
if (node != mRootNode) {
PProjectModelNode pNode = node; PProjectModelNode pNode = node;
while (pNode && pNode->folderNodeType == ProjectSpecialFolderNode::NonSpecial) { while (pNode && pNode->folderNodeType == ProjectSpecialFolderNode::NonSpecial) {
result = node->text + "/" +result; result = node->text + "/" +result;
pNode = pNode->parent.lock(); pNode = pNode->parent.lock();
} }
}
result = folder() + "/" + result; result = folder() + "/" + result;
return result; return result;
} }

View File

@ -17,7 +17,7 @@ SUBDIRS += \
APP_NAME = RedPandaCPP APP_NAME = RedPandaCPP
APP_VERSION = 1.0.8 APP_VERSION = 1.0.9
linux: { linux: {