Getting .exe stopped working when i try to clear textedit ...??

  • hello,
    here im dragging text content of "textedit" to "textedit_2" and when "textedit_2" gets text content i will send it through tcp/ip communication to receiver after sending i have to clear "textedit_2 " but when i attempt to do so im getting .exe stopped working. can anyone solve this problem.....??

    #include "mainwindow.h"
    #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    delete ui;

    void MainWindow::on_textEdit_2_textChanged()

    sendsocket = new QTcpSocket(this);
    QString hostaddress="";
    QString str=ui->textEdit_2->toPlainText();
     ui->textEdit_2->clear();-------------------------------------> // if i include this line its showing .exe stopped working           message //


  • Moderators


    Your code has memory corruption. This can happen for many reasons, such as if you forget to initialize a pointer, or if use a pointer after it has been deleted.

    Use a debugger to run your program (make sure you build it in Debug mode). It will give you more clues on where the memory corruption occurs.

    Also, please add '@' before and after your code to make it easier to read.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.