[Qt-interest] Pointer issue
Zine eddine Bendjaballah
zineeddine.b at gmail.com
Wed Feb 25 19:06:35 CET 2009
Hi,
I've a class called "Subject" in my project.
class Subject{
public:
QString name;
QString abbreviation;
QColor color;
Subject();
~Subject();
};
And an other class called SubjectModel;
class SubjectModel: public QAbstractTableModel
{
Q_OBJECT
public:
//Public declarations
...
private:
QList <Subject*> subjects ;
};
In the program I create a pointer to the Subject class with new instruction;
Subject* sbj = new Subject();
this pointer is added to the "subjects" list variable member of the
SubjectModel class.
till now all is right.
My program crashes when it arrive at this instruction:
if (subjects[i]->name == initialSubjectName)
The debugger shows that subjects[i]->name is out of scop, whereas
subjects[i+1], or subjects[i-1] is under scop.
in the attached you can find the content of Gdb pan (I use Qt creator
for debugging), and the screenshot of debugging process.
Best regards.
--
Zine Eddine Bendjaballah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090225/779bd672/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Qt creator debugger.jpg
Type: image/jpeg
Size: 126497 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090225/779bd672/attachment.jpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Gdb.doc
Type: application/msword
Size: 109056 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090225/779bd672/attachment.doc
More information about the Qt-interest-old
mailing list