PDA

View Full Version : qmldump error - segv



kornicameister
5th October 2011, 10:22
Hi there again,

I am having problem with qmldump, I will give the output which shows the best where the problem lies


" Processing object QDeclarativeAnchorAnimation
Error: qmldump SEGV


this is the error I am having, I found out that it lies somewhere in


qmlRegisterType<File>(uri, 1, 0, "File"); // <------- HERE IS THE PROBLEM
qmlRegisterType<FileBrowserModel>(uri, 1, 0, "FileBrowserModel");
qmlRegisterType<FileVisualProperties>(uri, 1, 0, "FileVisualProperties");
qmlRegisterType<FileVisualPropertyChunk>(uri, 1, 0, "FileVisualPropertyChunk");


because when I commented it out, qmldump finished with 0 exit code - no error detected.
I do not understand where is this problem.
I will give the header file of this as well


#ifndef FILE_H
#define FILE_H

#include <QDeclarativeItem>
#include <QFile>

/*
Basic informations about the file
such as for example name,path,absolute_path and so on
*/

class FilePrivate;
class File : public QDeclarativeItem
{
Q_OBJECT
Q_DISABLE_COPY(File)
Q_CLASSINFO("version","0.1")
Q_PROPERTY(QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged)
Q_PROPERTY(qint16 size READ size NOTIFY sizeChanged)
Q_PROPERTY(QString lastError READ lastError NOTIFY errorOccurred)
Q_PROPERTY(QString path READ path)
Q_PROPERTY(QString absolutePath READ absolutePath)
Q_PROPERTY(QString extension READ extension)
Q_PROPERTY(QString openMode READ openMode)
Q_PROPERTY(bool isSymlink READ isSymlink)
Q_PROPERTY(QUrl urlPath READ urlPath)
Q_PROPERTY(QUrl urlAbsolutePath READ urlAbsolutePath)
Q_PROPERTY(bool open READ isOpen)
Q_PROPERTY(bool hidden READ isHidden)
public:
explicit File(QDeclarativeItem *parent = 0);
virtual ~File();

QString fileName() const;
QString path() const; //returns relative path
QString absolutePath() const; //returns absolute path, cleaned
QString extension() const; //returns extension for the file
qint16 size() const; //see -> QFile::size
QString lastError() const;
QString openMode() const;
bool isSymlink() const;
void setFileName(const QString &fileName);
QUrl urlAbsolutePath() const;
QUrl urlPath() const;
bool isOpen() const;
bool isHidden() const;

// [AVAILABLE FOR QML AS METHODS]
Q_INVOKABLE bool rename(const QString &newName);//see -> QFile::rename
Q_INVOKABLE bool link(const QString &linkName); //see -> QFile::link
Q_INVOKABLE bool copy(const QString &newName); //see -> QFile::copy
Q_INVOKABLE bool exists() const; //see -> QFile::exists
Q_INVOKABLE QStringList links() const; //returns all symbolic/hard links to the file specified as m_fileName
Q_INVOKABLE qint16 linksCount() const; //returns count of all symbolic/hard links to the file specified as m_fileName
Q_INVOKABLE bool openFile(const QString &openMode); //opens the file, using qint16 value as the marker of the mode, see QIODevice::OpenMode
Q_INVOKABLE bool closeFile(); //closes the file, flushed the buffers etc.
// [AVAILABLE FOR QML AS METHODS]

signals:
void fileNameChanged(const QString &newFileName); //emitted every time a file name was changed
void sizeChanged(const qint16 &newSize); //emitted every time a file size was changed
void errorOccurred(const QString &errorString); //emitted every time an error has come out

private:
Q_DECLARE_PRIVATE(File)
FilePrivate * const d_ptr;
};

QML_DECLARE_TYPE(File)

#endif // FILE_H



no pointer anywhere, but it stuck on processing the animation...what is going on ?

kornicameister
6th October 2011, 10:51
Little update

I made a mistake writtin, in the previous post, that error comes out from File Item.

It's origin lies in the class which inherits both from QAbstractListModel, QDeclarativeParserStatus.
As to the interface I have appropriate macro Q_INTERFACES in class body.
The item is not drawable.

Here is the header file

#ifndef FILEBROWSERMODEL_H
#define FILEBROWSERMODEL_H

#include <QDeclarativeParserStatus>
#include <QFileSystemModel>
#include <QAbstractListModel>
#include <QUrl>
#include <QDeclarativeItem>

class FileBrowserModelPrivate;
class FileBrowserModel : public QAbstractListModel, public QDeclarativeParserStatus

{
Q_OBJECT
Q_DISABLE_COPY(FileBrowserModel)
Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged)
Q_PROPERTY(QUrl parentFolder READ parentFolder NOTIFY folderChanged)
Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters)
Q_PROPERTY(bool showDirs READ showDirs WRITE setShowDirs)
Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot)
Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable)
Q_PROPERTY(qint16 count READ count)
public:
explicit FileBrowserModel(QObject *parent = 0);
virtual ~FileBrowserModel();

enum Roles { FileNameRole = Qt::UserRole+1, FilePathRole = Qt::UserRole+2 };

//QAbstractListModel reimplementation
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
qint16 count() const;
//QAbstractListModel reimplementation
//QDeclarativeParserStatus reimplementation
virtual void classBegin();
virtual void componentComplete();
//QDeclarativeParserStatus reimplementation

//properties
QUrl folder() const;
void setFolder(const QUrl &folder);
QUrl parentFolder() const;
QStringList nameFilters() const;
void setNameFilters(const QStringList &filters);
bool showDirs() const;
void setShowDirs(bool enable);
bool showDotAndDotDot() const;
void setShowDotAndDotDot(bool enable);
bool showOnlyReadable() const;
void setShowOnlyReadable(bool enable);
bool showHidden() const;
void setShowHidden(bool enable);
//properties
Q_INVOKABLE bool isFolder(int index = -1) const;

signals:
void folderChanged();

private slots:
void refresh();
void handleDataChanged(const QModelIndex &start, const QModelIndex &end);
void rootDirChanged(const QString &newRoot);

private:
Q_DECLARE_PRIVATE(FileBrowserModel)
FileBrowserModelPrivate * const d_ptr;
};

QML_DECLARE_TYPE(FileBrowserModel)

#endif // FileBrowserModel_H


to be honest, I am trying to write the implementation of FolderListModel available at Qt docs, but instead of using obsolete QDir, I am trying to use QFileSystemModel