- change: Don't use 'pause' in the console pauser, in case of privilege problems.

- fix: parser use it's one keywords set , to prevent crash when exit
This commit is contained in:
royqh1979 2021-10-30 21:15:07 +08:00
parent 561c83ef58
commit e5e7635d1f
4 changed files with 8 additions and 29 deletions

View File

@ -33,6 +33,7 @@ CppParser::CppParser(QObject *parent) : QObject(parent)
mIsProjectFile = false;
mCppKeywords = CppKeywords;
mCppTypeKeywords = CppTypeKeywords;
//mNamespaces;
//mBlockBeginSkips;
//mBlockEndSkips;
@ -3566,7 +3567,7 @@ QString CppParser::removeArgNames(const QString &args)
} else if (!word.trimmed().isEmpty()) {
if (!typeGetted) {
currentArg += ' ' + word;
if (CppTypeKeywords.contains(word) || !isKeyword(word))
if (mCppTypeKeywords.contains(word) || !isKeyword(word))
typeGetted = true;
} else {
if (isKeyword(word))

View File

@ -370,6 +370,7 @@ private:
QRecursiveMutex mMutex;
GetFileStreamCallBack mOnGetFileStream;
QMap<QString,SkipType> mCppKeywords;
QSet<QString> mCppTypeKeywords;
};
using PCppParser = std::shared_ptr<CppParser>;

View File

@ -3,7 +3,7 @@
#include <QStringList>
#define DEVCPP_VERSION "0.7.5"
#define DEVCPP_VERSION "0.7.6"
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
#ifdef Q_OS_WIN

View File

@ -58,37 +58,14 @@ void PauseExit(int exitcode, bool reInp) {
FILE_SHARE_READ , &sa, OPEN_EXISTING, /*FILE_ATTRIBUTE_NORMAL*/0, NULL);
//si.hStdInput = hInp;
SetStdHandle(STD_INPUT_HANDLE,hInp);
freopen("CONIN$","r",stdin);
}
//system("pause");
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si,0,sizeof(si));
si.cb = sizeof(si);
memset(&pi,0,sizeof(pi));
DWORD dwCreationFlags = CREATE_BREAKAWAY_FROM_JOB;
if(!CreateProcess(NULL, (LPSTR)"cmd /c \"pause\"", NULL, NULL, true, dwCreationFlags, NULL, NULL, &si, &pi)) {
printf("\n--------------------------------");
printf("\nFailed to execute 'pause' ");
printf("\nError %lu: %s\n",GetLastError(),GetErrorMessage().c_str());
system("pause");
exit(exitcode);
}
WINBOOL bSuccess = AssignProcessToJobObject( hJob, pi.hProcess );
if ( bSuccess == FALSE ) {
printf( "AssignProcessToJobObject failed: error %d\n", GetLastError() );
system("pause");
exit(exitcode);
}
WaitForSingleObject(pi.hProcess, INFINITE); // Wait for it to finish
printf("\n");
printf("Press ANY key to continue...\n");
getchar();
if (reInp) {
CloseHandle(hInp);
}
CloseHandle( hJob );
exit(exitcode);
}