Roobiq / RBQFetchedResultsController

Drop-in replacement for NSFetchedResultsController backed by Realm.
MIT License
477 stars 70 forks source link

Delegate never released #120

Open stephenkopylov opened 7 years ago

stephenkopylov commented 7 years ago

Hi everyone and thank you for this library!

But, after a day of research I found really sad bug:

If we do any database modifications after "performFetch" - delegate will be retained somewhere and won't be released.

It brings a lot of pain and makes the library unusable =(

I have slightly edited sample project to make this bug more obviously: http://rgho.st/8b9RLZN6L

Have a look on "viewDidLoad" in "ExampleTableViewController" and try to comment and uncomment calling of "writeObjects" before and after "performFetch". Then press back and you will see that "ExampleTableViewController" will never released.

bigfish24 commented 7 years ago

Sorry about this! I thought I had resolved any retain cycles. I will check out the sample app and hopefully resolve.

stephenkopylov commented 7 years ago

Hi, Adam! Did you check it?

AnthonyMDev commented 7 years ago

I'd really like to use this library also, but a retain cycle in the delegate makes this unusable. Hope to see this resolved soon!

0xced commented 7 years ago

I think I have observed the same issue in ABFRealmTableViewController. Here’s the workaround I am using: https://github.com/0xced/ABFRealmTableViewController/commit/093d6ed6adce37b9a8321ac6b9e53e017168ce2f

I still haven’t figured out the retain cycle though. 🙁

0xced commented 7 years ago

Oh, apparently this issue is already being investigated in #102.

smolskyaleksey commented 7 years ago

@0xced your hot fix is help me. Need to call unregisterChangeNotifications. But really lib have problem with delegate,self.notificationRunLoop and autorelease pool. Library still retain delegate.

stephenkopylov commented 7 years ago

Any news?