ImageViewer icon indicating copy to clipboard operation
ImageViewer copied to clipboard

Shouldn't the delegate and datasources be weak?

Open Ricardo1980 opened this issue 8 years ago • 5 comments

I see this in the source code.

// DATASOURCE/DELEGATE fileprivate let itemsDelegate: GalleryItemsDelegate? fileprivate let itemsDataSource: GalleryItemsDataSource fileprivate let pagingDataSource: GalleryPagingDataSource

Shouldn't they be weak?

Ricardo1980 avatar Jun 05 '17 12:06 Ricardo1980

Really? I have memory problems when set myself as dataSource and keeping in memory

yaddaa avatar Oct 04 '17 16:10 yaddaa

Hmm, this might have been a slight oversight when designing it, or there could be a good reason, anyway, @Ricardo1980 can you give it a spin in the demo project?

RuiAAPeres avatar Oct 04 '17 19:10 RuiAAPeres

This will clearly cause a memory leak unless the caller explicitly dispose the GalleryViewController.

gabrielgava avatar Dec 12 '18 17:12 gabrielgava

I got the same issue too. How do u guys solve this?

davuthdv avatar Oct 22 '20 17:10 davuthdv

I got the same issue too. How do u guys solve this?

You can just pass it an object that conforms to GalleryItemsDataSource. Seems like a design flaw or as intended.

mikechan1234 avatar Sep 09 '21 12:09 mikechan1234