Details

[Home]

Issue of the Implementation # S0727

Brief

Interface QTextObject::format() const crashes on any parameters

Detailed Description

Interface QTextObject::format() const crashes on any parameters.

Problem location(s) in the standard

http://doc.trolltech.com/4.2/qtextobject.html#format

Example

#include <QApplication>
#include <QtCore/qtimer.h>
#include <QtGui/qtextobject.h>
#include <QtGui/qtextdocument.h>

class QTextDocumentChild: public QTextDocument
{
public:
    QTextDocumentChild
    (
            const QString & Par_1,
            QObject * Par_2
    );
    QTextObject * createObject_Adv(const QTextFormat & Par_1);
};

QTextObject* create_QTextObject()
{
    QTextDocumentChild * Par_0_0 = new QTextDocumentChild("XXX", NULL);
    QTextFormat Par_0_1(QTextFormat::ListFormat);
    return Par_0_0->createObject_Adv(Par_0_1);
}

QTextDocumentChild::QTextDocumentChild
(
    const QString & Par_1,
    QObject * Par_2
):QTextDocument(Par_1, Par_2){}

QTextObject * QTextDocumentChild::createObject_Adv(const QTextFormat & Par_1)
{
    return this->createObject(Par_1);
}

int main()
{
    //PREAMBLE
    #ifdef Q_WS_X11
    bool useGUI = getenv( "DISPLAY" ) != 0;
    #else
    bool useGUI = TRUE;
    #endif
    int app_argc = 1;
    char* app_argv[2]={"", NULL};
    QApplication::setColorSpec(QApplication::ManyColor);
    QApplication* app = new QApplication(app_argc, app_argv, useGUI);
    
    //PARAMETER INITIALIZATION
    QTextObject * Obj = create_QTextObject();

    //TARGET INTERFACE
    Obj->format();

    QTimer::singleShot(100, app, SLOT(quit()));
    return app->exec();
}

Component

qt4 4.2 or later

Accepted

Qt Software Task Tracker 246138

Status

Fixed in qt4 4.5.1

[Home]