Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 188
Registered: ‎07-19-2012
My Device: Z10 LE
My Carrier: Three

Using images in a ListView causes a SegFault

My app currently uses a custom listview (using a ListItemListener and ListItemProvider) that loads images over the network and displays the appropriate image next to each list item. This works fine for any list items that are currently displayed, but setting the image source for an off-screen list item results in a Segfault at bb::cascades::Image:Smiley Surprisedperator=() at 0x79446f3c. This happens for both setting the image source to the path of the locally downloaded image, and for tracking that image's state and using setImage().


This particular list works by inserting a container (InnerItem) into my list item. This InnerItem is a container which is replaced by a different instance when the user swipes left or right. 


I want to have these images downloaded in the background and displayed in the list item's ImageView as that item scrolls into view, avoiding this segfault. is there any way of achieving this?


Here's some sample code:



For the ListItemListener:

void MyListItemClass::onInnerListChanged() {
	if(mInnerList.size() > 0) {
		InnerItem* innerItem = new InnerItem(mBroadcasts.at(currentIndex));


For the InnerItem, I can confirm the image has downloaded successfully, but the SegFault only occurs when setting the image source or image:

 * Updates the episode preview image when downloaded
void InnerItem::onImageProcessed(QUrl url) {
	if(imgPreview) {
	qDebug() << "Image is visible, setting to " << url.toString();

	// Let's try tracking
	mTrack = new ImageTracker(url);
	bool result = connect(mTrack, SIGNAL(stateChanged(bb::cascades::ResourceState::Type)),
			this, SLOT(onStateChanged(bb::cascades::ResourceState::Type)));

void EpisodeItem::onStateChanged(bb::cascades::ResourceState::Type state) {
	if(state == ResourceState::Loaded) {


Did this post help you? If so, please make sure to "like" it!