lemanhtrung / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

after port->close(); program shows bad behavior and remains in memory after exit #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I just scan for com ports:
    comboBox->clear();
    QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
    if (ports.size()!=0){
        pushButton_OpenPorts->setEnabled(TRUE);
        comboBox->setEnabled(TRUE);
        for (int i = 0; i < ports.size(); i++) {
            if (ports.at(i).portName.toLocal8Bit().contains("COM")){

comboBox->addItem(ports.at(i).portName.toLocal8Bit().constData(),0);
            }
       }
    } else {
        pushButton_OpenPorts->setEnabled(FALSE);
        comboBox->clear();
        comboBox->setEnabled(FALSE);
    }

2. Open the port with 
    if (comboBox->count()!=0){
        port = new QextSerialPort(comboBox->currentText());
        port->setBaudRate(BAUD9600);
        port->setFlowControl(FLOW_OFF);
        port->setDataBits(DATA_8);
        port->setParity(PAR_NONE);
        port->setStopBits(STOP_1);
        port->setTimeout(500);
        port->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
        port->setBaudRate(BAUD9600);    // just do it twice
        port->setFlowControl(FLOW_OFF);
        port->setDataBits(DATA_8);
        port->setParity(PAR_NONE);
        port->setStopBits(STOP_1);
        port->setTimeout(500);

        if (port->isOpen()) { ....
3. and then close the port with
    port->close();

What is the expected output? What do you see instead?
Program seems not to get WindowsMessages properly and remains in the system
memory (and process context) after a system close(); - with the "old" win
1.2 version I don't see this "wrong" behavior. 

What version of the product are you using? On what operating system?
Latest hg version on WinXP 32 and 64

Please provide any additional information below.

Original issue reported on code.google.com by mafofo...@gmail.com on 23 Feb 2010 at 10:02

GoogleCodeExporter commented 9 years ago
I've attached a simple project to show this behavior. It is done with QT 
Creator.

Regards, mafofolus

Original comment by mafofo...@gmail.com on 25 Feb 2010 at 4:51

Attachments:

GoogleCodeExporter commented 9 years ago
... after changing the port = new line to Polling:

port = new QextSerialPort(comboBox->currentText(),QextSerialPort::Polling);

all is shiny again.

Regards mafofolus

Original comment by mafofo...@gmail.com on 6 Mar 2010 at 2:45

GoogleCodeExporter commented 9 years ago

Original comment by dbzhang...@gmail.com on 19 Apr 2012 at 2:01