segmetation fault

I need help. How can i fix that.I am getting a stackoverflow. I want to swap the names of my labels by pressing the swapLabels Button.

1
2
3
QString A=ui->LabelRight->text();
    on_swapLabels_clicked();
    ui->LabelLeft->setText(A);
Last edited on
"segmetation fault" means you are trying to access an invalid memory address.

This most commonly happens by dereferencing a "dangling" (invalidated) or uninitialized pointer.

But it's impossible to say with this small code excerpt what your particular problem is...

There is nothing obviously wrong in this code excerpt, but what does on_swapLabels_clicked() do?
Last edited on
on_swapLabels_clicked() swaps the labels.

for example.

Label1= Hello , Label2=World




if i press on_swapLabels_clicked() the labels swap!


Label1=World , Label2=Hello
Last edited on
How does on_swapLabels_clicked() know what label to swap?

If you're getting "a stack overflow", then you likely have infinite recursion somewhere.
Topic archived. No new replies allowed.