[Development] Too long text in qlabel crashes my gdm

Kotanski, Jan jan.kotanski at desy.de
Thu Sep 29 22:48:10 CEST 2016


Replacing into QString it crashes as well, i.e. 

#ifndef UI_DIALOG_H 
#define UI_DIALOG_H 

#include <QtCore/QVariant> 
#include <QtGui/QAction> 
#include <QtGui/QApplication> 
#include <QtGui/QButtonGroup> 
#include <QtGui/QDialog> 
#include <QtGui/QFormLayout> 
#include <QtGui/QHeaderView> 
#include <QtGui/QLabel> 
#include <QtGui/QVBoxLayout> 

QT_BEGIN_NAMESPACE 

class Ui_Dialog 
{ 
public: 
QFormLayout *formLayout; 
QVBoxLayout *verticalLayout; 
QLabel *label; 

void setupUi(QDialog *Dialog) 
{ 
if (Dialog->objectName().isEmpty()) 
Dialog->setObjectName(QString::fromUtf8("Dialog")); 
Dialog->resize(355, 37); 
formLayout = new QFormLayout(Dialog); 
formLayout->setSpacing(6); 
formLayout->setContentsMargins(11, 11, 11, 11); 
formLayout->setObjectName(QString::fromUtf8("formLayout")); 
verticalLayout = new QVBoxLayout(); 
verticalLayout->setSpacing(6); 
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); 
label = new QLabel(Dialog); 
label->setObjectName(QString::fromUtf8("label")); 
verticalLayout->addWidget(label); 

formLayout->setLayout(0, QFormLayout::LabelRole, verticalLayout); 

retranslateUi(Dialog); 
QMetaObject::connectSlotsByName(Dialog); 
} // setupUi 

void retranslateUi(QDialog *Dialog) 
{ 
Dialog->setWindowTitle(QString("Dialog")); 
char str[2000]; 
for(int i=0; i<1999;i++) 
str[i] = 'a'; 
str[1999]='\0'; 
label->setText(QString(str)); 
} // retranslateUi 

}; 

namespace Ui { 
class Dialog: public Ui_Dialog {}; 
} // namespace Ui 

QT_END_NAMESPACE 

#endif // UI_DIALOG_H 

From: "Alexander Nassian" <nassian at bitshift-dynamics.de> 
To: "Kotanski, Jan" <jan.kotanski at desy.de> 
Cc: "development" <development at qt-project.org> 
Sent: Thursday, 29 September, 2016 22:17:01 
Subject: Re: [Development] Too long text in qlabel crashes my gdm 

FTR on my macOS machine with Qt 5.7.0 it doesn’t crash. 
What Qt version do you use? QApplication::UnicodeUTF8 is unknown as well as the translate() overload that your code uses. 

Beste Grüße / Best regards, 
Alexander Nassian, bitshift dynamics GmbH 




Am 29.09.2016 um 22:08 schrieb Kotanski, Jan < jan.kotanski at desy.de >: 

Hi, 

I've noticed that too long test in qlabel e.g. 

void retranslateUi(QDialog *Dialog) 
{ 
Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", 0, QApplication::UnicodeUTF8)); 
char str[2000]; 
for(int i=0; i<1999;i++) 
str[i] = 'a'; 
str[1999]='\0'; 
label->setText(QApplication::translate("Dialog", str, 0, QApplication::UnicodeUTF8)); 
} // retranslateUi 

crashed my gdm (for gnome 3). 

Is it a known problem? How to fix it? 

More info on: 

https://www.riverbankcomputing.com/pipermail/pyqt/2016-September/038145.html 

Bests, 
Jan 
_______________________________________________ 
Development mailing list 
Development at qt-project.org 
http://lists.qt-project.org/mailman/listinfo/development 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160929/ca3ed09e/attachment.html>


More information about the Development mailing list