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. Getting .exe stopped working when i try to clear textedit ...??
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 668 Views 1 Watching
  • 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
    ecmanja
    wrote on last edited by
    #1

    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) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_textEdit_2_textChanged()
    {

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

    }
    @

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      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.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      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