DyCI / dyci-main

Dynamic Code Injection Tool for Objective-C
MIT License
1.12k stars 121 forks source link

Retain class observers #101

Open zintus opened 9 years ago

zintus commented 9 years ago

Observers are referenced as __unsafe_unretained, but sometimes observers released, leading to crash on notification. Fix this by retaining observers.

Other approach may be keeping week references to observers, but i've took simple way :)

zintus commented 9 years ago

Bump @PaulTaykalo

PaulTaykalo commented 9 years ago

@zintus In case if we'll do this, no instance will be ever released, and everything will be in memory. It's probably ok for small projects, but on big ones, you'll be out of memory very short :) If you know what objects are not being released, then, probably, we'll be able to fix this one.

zintus commented 9 years ago

Your point is perfectly valid, it's not viable solution for big projects.

I've investigated further and did find that unsubscription fails for objects changing their class after initialization. Realm doing this, so disable notifying objects with RLM class prefix. Injecting realm classes is meaningless anyway, because live schema changes aren't supported.

zintus commented 9 years ago

@PaulTaykalo gentle bump :)

PaulTaykalo commented 9 years ago

Sorry, @zintus I missed your commit. Will check this one :) you can use your branch for a now. I 'll check if it's not crashing other parts of application.

Also, for next releases, I think it's better to allow user to select what objects he want to be injected. Ping me in few days, please

PaulTaykalo commented 9 years ago

It's good to have a project with libraries installed to check how it's working and check if it's failing or not Probably, will make one