- fix: Crash when create or open txt files in project.

This commit is contained in:
Roy Qu 2023-02-10 19:28:18 +08:00
parent 78f9aa8b3c
commit 6b4bfc3e64
4 changed files with 24 additions and 11 deletions

View File

@ -1,6 +1,7 @@
Red Panda C++ Version 2.12 Red Panda C++ Version 2.12
- fix: Can't correctly load project's custom compile options, if it contains more than one line contents. - fix: Can't correctly load project's custom compile options, if it contains more than one line contents.
- fix: Crash when create or open txt files in project.
Red Panda C++ Version 2.11 Red Panda C++ Version 2.11
@ -23,6 +24,9 @@ Red Panda C++ Version 2.11
- fix: preprocessors is not correctly suggested. - fix: preprocessors is not correctly suggested.
- fix: javadoc-style docstring is not correctly suggested - fix: javadoc-style docstring is not correctly suggested
- enhancement: Better syntax color for asm files. - enhancement: Better syntax color for asm files.
- enhancement: Add nasm.exe in the gcc distributed with RedPanda-CPP
- enhancement: Add assembly templates
Red Panda C++ Version 2.10 Red Panda C++ Version 2.10

View File

@ -120,7 +120,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
} }
if (mProject) { if (mProject) {
if (syntaxer->language() == QSynedit::ProgrammingLanguage::CPP) if (syntaxer && syntaxer->language() == QSynedit::ProgrammingLanguage::CPP)
mParser = mProject->cppParser(); mParser = mProject->cppParser();
} else { } else {
initParser(); initParser();
@ -4316,7 +4316,7 @@ void Editor::setProject(Project *pProject)
return; return;
mProject = pProject; mProject = pProject;
if (mProject) { if (mProject) {
if (syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) { if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) {
mParser = mProject->cppParser(); mParser = mProject->cppParser();
if (isVisible()) { if (isVisible()) {
if (mParser && mParser->parsing()) { if (mParser && mParser->parsing()) {

View File

@ -948,6 +948,17 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
cleanPath(dir.absoluteFilePath(templateUnit->Source)), cleanPath(dir.absoluteFilePath(templateUnit->Source)),
includeTrailingPathDelimiter(this->directory())+target); includeTrailingPathDelimiter(this->directory())+target);
unit = newUnit(mRootNode, target); unit = newUnit(mRootNode, target);
FileType fileType=getFileType(unit->fileName());
if (fileType==FileType::ASM
|| isCFile(unit->fileName()) || isHFile(unit->fileName())) {
Editor * editor = mEditorList->newEditor(
unit->fileName(),
unit->encoding()==ENCODING_PROJECT?options().encoding:unit->encoding(),
this,
false);
editor->activate();
}
} else { } else {
QString s; QString s;
PProjectUnit unit; PProjectUnit unit;

View File

@ -8,15 +8,13 @@ fmt: db "%s", 10, 0 ; The printf format, "\n",'0'
section .text: section .text:
main: main:
push rbp ; align our stack at entry ; the x64 calling convention requires you to allocate 32 bytes of shadow space before each call
mov rbp, rsp ; use RBP as frame reference ; https://stackoverflow.com/questions/30190132/what-is-the-shadow-space-in-x64-assembly/
sub rsp, 32 ; our 16-byte aligned local storage area sub rsp, 32 ; allocate shadow space for call
mov rcx, fmt ; first parameter
mov rcx, fmt mov rdx, msg ; secodng parameter
mov rdx, msg
call printf call printf
add rsp,32 ; remove shadow space
mov eax,0 ; exit code mov eax,0 ; exit code
add rsp,32 ; restore stack ret
pop rbp ; restore stack
ret