Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Application Keep Crashing

Application Keep Crashing

Scheduled Pinned Locked Moved Solved General and Desktop
c++
5 Posts 4 Posters 528 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ELEMENTICY
    wrote on last edited by
    #1

    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 = )

    jsulmJ 1 Reply Last reply
    0
    • E ELEMENTICY

      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 = )

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @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.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply
      7
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by
        #2

        and what in-line coding have you done to determine exactly where it is crashing? On what line?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #3

          " 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.

          1 Reply Last reply
          1
          • E ELEMENTICY

            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 = )

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @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.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            E 1 Reply Last reply
            7
            • jsulmJ jsulm

              @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.

              E Offline
              E Offline
              ELEMENTICY
              wrote on last edited by
              #5

              @jsulm Its worked!Thanks dude =D

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved