T
T
Tesla4o2019-06-24 09:45:20
Qt
Tesla4o, 2019-06-24 09:45:20

Why does a Segmentation fault occur on a form when the Enter button is pressed while entering data?

For example, there is a login password entry form. Created a slot that is called by the Submint button with the released() signal. And also this slot with QLineEdit is called by the returnPressed() signal to press the Enter button. If you just click the Submint button with the mouse, then everything is fine. And if you press Enter on LineEdit, then Segmentation Fault crashes. Who can tell why? Where is my joint?
Pseudocode:

connect(button, SIGNAL(released()), SLOT(auth())); // работает хорошо!
connect(lineEdit, SIGNAL(returnPressed(), SLOT(auth())); // вылетает SIGSEG

void auth() {
    //auth code
}

UPD:
I also checked it with the gdb program, it gives the following error -
0x00007ffff4b79d7e in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

OS Ubuntu 18

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tesla4o, 2019-06-24
@Tesla4o

Thank you all for your attention!) Qt::QueuedConnection solved the problem.
This article helped here www.prog.org.ru/topic_18602_0.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question