QApplication Crashed ..
-
I have an application running in Windows 10. The application opens a tiff image and displays in QLabel. QLabel *imageLabel; in header file
Initialization
imageLabel = new QLabel;
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
imageLabel->setScaledContents(true);Application works fine .
However when i add another Label it crashes.
QLabel *processedImageLabel; in header file
processedImageLabel = new QLabel; in constructorI ran the program in debug mode,
I got a pop up window sayingInferior stopped because it received a signal from operating system.
Signal name: SIGSEGV
Signal meaning: Segmentation Fault.Why a segmentation fault even though 'new' operator is used to allocate memory. And pervious declaration works fine. I am not doing anything different.
Requesting help
-
I have an application running in Windows 10. The application opens a tiff image and displays in QLabel. QLabel *imageLabel; in header file
Initialization
imageLabel = new QLabel;
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
imageLabel->setScaledContents(true);Application works fine .
However when i add another Label it crashes.
QLabel *processedImageLabel; in header file
processedImageLabel = new QLabel; in constructorI ran the program in debug mode,
I got a pop up window sayingInferior stopped because it received a signal from operating system.
Signal name: SIGSEGV
Signal meaning: Segmentation Fault.Why a segmentation fault even though 'new' operator is used to allocate memory. And pervious declaration works fine. I am not doing anything different.
Requesting help
Please provide a minimal example and format your code with code tags so it is readable. Your pieces above are fine. If your application crashes then you normally take a debugger to see where exactly it is crashing.
-
I have an application running in Windows 10. The application opens a tiff image and displays in QLabel. QLabel *imageLabel; in header file
Initialization
imageLabel = new QLabel;
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
imageLabel->setScaledContents(true);Application works fine .
However when i add another Label it crashes.
QLabel *processedImageLabel; in header file
processedImageLabel = new QLabel; in constructorI ran the program in debug mode,
I got a pop up window sayingInferior stopped because it received a signal from operating system.
Signal name: SIGSEGV
Signal meaning: Segmentation Fault.Why a segmentation fault even though 'new' operator is used to allocate memory. And pervious declaration works fine. I am not doing anything different.
Requesting help
@GopalS said in QApplication Crashed ..:
However when i add another Label it crashes.
QLabel *processedImageLabel; in header file processedImageLabel = new QLabel; in constructor
This pointer is local to the constructor and may be masking another pointer that never gets initialised, e.g. one declared as a member of the class. Using an uninitialised member variable pointer will likely end how you describe.
-
@GopalS said in QApplication Crashed ..:
However when i add another Label it crashes.
QLabel *processedImageLabel; in header file processedImageLabel = new QLabel; in constructor
This pointer is local to the constructor and may be masking another pointer that never gets initialised, e.g. one declared as a member of the class. Using an uninitialised member variable pointer will likely end how you describe.
@ChrisW67
Well not as show it is not, the second line in the constructor just uses the one declared in the.h
file?Nonetheless, until we see actual code we don't know and it might well be that in fact the second one has a declaration in the constructor as you say....