Application Keep Crashing
-
Hello there...
I got an issue on my code
so this is my code:
Editor::Editor(QWidget *parent) : QMainWindow(parent), ui(new Ui::Editor) { ui->setupUi(this); m_htmlHighLighter = new HtmlHighLighter(ui->codingarea->document()); QFile Setting_Open("setting.data"); QString searchTheme("theme = light;"); Setting_Open.open(QIODevice::ReadWrite); QTextStream in (&Setting_Open); QString line; do { line = in.readLine(); if (!line.contains(searchTheme, Qt::CaseSensitive)) { Editor w; w.setStyleSheet("background-color: white;\ncolor: black;\nborder-bottom-width: 0;"); ui->fileExplorer->setStyleSheet("background-color: whitesmoke;border-style: solid;border-right-width: 2px;color: white;"); ui->labelatexplorer->setStyleSheet("background-color: whitesmoke; color: black;"); ui->console->setStyleSheet("#console {\nfont-family: 'Lucida Console', Monaco, monospace;\npadding: 5px;\nborder-style: solid;\nborder-color: #c2c2c2;\nborder-top-width: 70px;\nbackground-color: #f5f5f5;\ncolor: lime;\n}\n#console document {}\n#console document:hover {\nbackground-color: black;\ncolor: white;\n}"); ui->label->setStyleSheet("background-color: #c2c2c2;color: black; font-size: 50px;"); } } while (!line.isNull()); }
When delete these code,It work fine.But when i keep them,my Application Just Crashed.I dont want to remove them because its important for my Application.
this is the error code:
C:\Users\YouGay\Desktop\build-BareCodeEditor-Desktop_Qt_5_13_2_MSVC2017_64bit-Release\release\BareCodeEditor.exe crashed.
Anyone please help me,Thanks = )
-
@ELEMENTICY said in Application Keep Crashing:
Setting_Open.open(QIODevice::ReadWrite);
Please check whether open() succeeded.
Editor w;
Are you aware that you create another instance of Editor in Editor constructor which creates an infinite loop and most probably the cause of the crash?
Why do you do this?! This does not make sense. -
and what in-line coding have you done to determine exactly where it is crashing? On what line?
-
" Reverse " do - while loop to just while (condition) , little safer to check the condition first.
Run in debug - select break points and "step " thru the code until it breaks.
Or insert "exit(x)" at suspected location and run the code until it breaks.
-
@ELEMENTICY said in Application Keep Crashing:
Setting_Open.open(QIODevice::ReadWrite);
Please check whether open() succeeded.
Editor w;
Are you aware that you create another instance of Editor in Editor constructor which creates an infinite loop and most probably the cause of the crash?
Why do you do this?! This does not make sense.