Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, October 2006
QItemSelectionModel::selectedIndexes crash in slot


Message 1 in thread

My app is crashing when the QModelItemList returned from
QItemSelectionModel::selectedIndexes() is destructed from within a slot
connected to that QItemSelectionList::selectionChanged() signal. I saw this
on OS X then it when away, and it crashes on windows every time.  The same
thing happens if I call QItemSelectionModel::selection().indexes().


Is this a know QList or QItemSelection bug? thanks.

-- 
 [ signature omitted ] 

Message 2 in thread

I have isolated the problem to a simple model subclass in the attached
50-liner....

if you change the model as indicated it works
flags Select and ClearAndSelect crash it
flags Current doesn't crash it.

ideas? something wrong with the subclass? maybe the project file?


On 10/6/06, Patrick Stinson <patrickkidd.lists@xxxxxxxxx> wrote:
>
> My app is crashing when the QModelItemList returned from
> QItemSelectionModel::selectedIndexes() is destructed from within a slot
> connected to that QItemSelectionList::selectionChanged() signal. I saw this
> on OS X then it when away, and it crashes on windows every time.  The same
> thing happens if I call QItemSelectionModel::selection().indexes().
>
>
> Is this a know QList or QItemSelection bug? thanks.
>
> --
> Patrick Kidd Stinson
> http://www.patrickkidd.com/
> http://pkaudio.sourceforge.net/
> http://pksampler.sourceforge.net/




-- 
 [ signature omitted ] 

Attachment: qlist_crash.zip
Description: Zip archive


Message 3 in thread

On Sunday 08 October 2006 00:55, Patrick Stinson wrote:
> I have isolated the problem to a simple model subclass in the attached
> 50-liner....
>
> if you change the model as indicated it works
> flags Select and ClearAndSelect crash it
> flags Current doesn't crash it.
>
> ideas? something wrong with the subclass? maybe the project file?
>
> On 10/6/06, Patrick Stinson <patrickkidd.lists@xxxxxxxxx> wrote:
> > My app is crashing when the QModelItemList returned from
> > QItemSelectionModel::selectedIndexes() is destructed from within a slot
> > connected to that QItemSelectionList::selectionChanged() signal. I saw
> > this on OS X then it when away, and it crashes on windows every time. 
> > The same thing happens if I call
> > QItemSelectionModel::selection().indexes().
> >
> >
> > Is this a know QList or QItemSelection bug? thanks.
> >
> > --
> > Patrick Kidd Stinson
> > http://www.patrickkidd.com/
> > http://pkaudio.sourceforge.net/
> > http://pksampler.sourceforge.net/

Send this example to TT bugs, they will be able to forward it to the person 
who can best handle it.

-Benjamin Meyer

--
 [ signature omitted ] 

Message 4 in thread

I sent a commercial support request when I posted this to this list, so
we'll see hwat that turns up...

On 10/9/06, Benjamin Meyer <bmeyer@xxxxxxxxxxxxx> wrote:
>
> On Sunday 08 October 2006 00:55, Patrick Stinson wrote:
> > I have isolated the problem to a simple model subclass in the attached
> > 50-liner....
> >
> > if you change the model as indicated it works
> > flags Select and ClearAndSelect crash it
> > flags Current doesn't crash it.
> >
> > ideas? something wrong with the subclass? maybe the project file?
> >
> > On 10/6/06, Patrick Stinson <patrickkidd.lists@xxxxxxxxx> wrote:
> > > My app is crashing when the QModelItemList returned from
> > > QItemSelectionModel::selectedIndexes() is destructed from within a
> slot
> > > connected to that QItemSelectionList::selectionChanged() signal. I saw
> > > this on OS X then it when away, and it crashes on windows every time.
> > > The same thing happens if I call
> > > QItemSelectionModel::selection().indexes().
> > >
> > >
> > > Is this a know QList or QItemSelection bug? thanks.
> > >
> > > --
> > > Patrick Kidd Stinson
> > > http://www.patrickkidd.com/
> > > http://pkaudio.sourceforge.net/
> > > http://pksampler.sourceforge.net/
>
> Send this example to TT bugs, they will be able to forward it to the
> person
> who can best handle it.
>
> -Benjamin Meyer
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>


-- 
 [ signature omitted ] 

Message 5 in thread

My hunch is that it is a bug in QList's internal shared references
mechanism. Data is stored internally by pointers and maintained with
reference counts. The containing object is obviousl being deleted somewhere.
I saw this on OS X a while ago too.

On 10/9/06, Patrick Stinson <patrickkidd.lists@xxxxxxxxx> wrote:
>
> I sent a commercial support request when I posted this to this list, so
> we'll see hwat that turns up...
>
> On 10/9/06, Benjamin Meyer <bmeyer@xxxxxxxxxxxxx> wrote:
> >
> > On Sunday 08 October 2006 00:55, Patrick Stinson wrote:
> > > I have isolated the problem to a simple model subclass in the attached
> >
> > > 50-liner....
> > >
> > > if you change the model as indicated it works
> > > flags Select and ClearAndSelect crash it
> > > flags Current doesn't crash it.
> > >
> > > ideas? something wrong with the subclass? maybe the project file?
> > >
> > > On 10/6/06, Patrick Stinson <patrickkidd.lists@xxxxxxxxx> wrote:
> > > > My app is crashing when the QModelItemList returned from
> > > > QItemSelectionModel::selectedIndexes() is destructed from within a
> > slot
> > > > connected to that QItemSelectionList::selectionChanged() signal. I
> > saw
> > > > this on OS X then it when away, and it crashes on windows every
> > time.
> > > > The same thing happens if I call
> > > > QItemSelectionModel::selection().indexes().
> > > >
> > > >
> > > > Is this a know QList or QItemSelection bug? thanks.
> > > >
> > > > --
> > > > Patrick Kidd Stinson
> > > > http://www.patrickkidd.com/
> > > > http://pkaudio.sourceforge.net/
> > > > http://pksampler.sourceforge.net/
> >
> > Send this example to TT bugs, they will be able to forward it to the
> > person
> > who can best handle it.
> >
> > -Benjamin Meyer
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> > "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
> >
>
>
> --
> Patrick Kidd Stinson
> http://www.patrickkidd.com/
> http://pkaudio.sourceforge.net/
> http://pksampler.sourceforge.net/
>



-- 
 [ signature omitted ] 

Message 6 in thread

Patrick Stinson wrote:
> My hunch is that it is a bug in QList's internal shared 
> references mechanism. Data is stored internally by pointers 
> and maintained with reference counts. The containing object 
> is obviousl being deleted somewhere. I saw this on OS X a 
> while ago too. 

QList itself seems fairly robust to me.

However, it is suceptible to being used wrongly due to the
'false friend' association  QList <-> std::list.

For one, QList::push_back() invalidates _all_ iterators on the list,
whereas std::list does not.

And there's at least on place in the source where Qt developers
themselves fell into the pit (qmake/generators/unix/unixmake.cpp,
around line 430, causing a hard crash under certain circumstances)

The problem you pointed out may as well be the reason of invalid
iterators.

Andre'

--
 [ signature omitted ] 

Message 7 in thread

Patrick Stinson wrote:
> My app is crashing when the QModelItemList returned from 
> QItemSelectionModel::selectedIndexes() is destructed from 
> within a slot connected to that 
> QItemSelectionList::selectionChanged() signal. I saw this on 
> OS X then it when away, and it crashes on windows every time. 
>  The same thing happens if I call 
> QItemSelectionModel::selection().indexes(). 

I've seen this (or something smelling like it) in Win XP since
early 4.0.x, maybe even since beta.

The crashes are less common in later release but still there.

I have not been able to create a deterministic minimal example
so far. My workaround is to iterate over all items in the model
and put all selected ones in a list of my own. This has not yet
crashed so far.

I have a suspicion that it happens (more often?) after parts
of the model have been deleted.

> Is this a know QList or QItemSelection bug? thanks.

Known to TT? I don't know...

Andre'

--
 [ signature omitted ]