xamarin / Xamarin.Social

Xamarin.Social
Apache License 2.0
124 stars 74 forks source link

Why create two different ACAccountStore instances? #10

Closed gaearon closed 10 years ago

gaearon commented 11 years ago

@ermau I wasn't sure where to post this, so I post here.

Why do you keep one instance of ACAccountStore, but use a new one every time?
I'm looking at GetAccountsAsync in Twitter5Service:

public override Task<IEnumerable<Account>> GetAccountsAsync ()
{
    if (accountStore == null) {
        accountStore = new ACAccountStore ();
    }
    var store = new ACAccountStore ();
    var at = store.FindAccountType (ACAccountType.Twitter);

Note that you're working with store, while a reference to accountStore is kept.

I saw threads about ACAccounts dead without their store, but surely accountStore is different from store so it doesn't help?

I'm confused.

ermau commented 11 years ago

Good question; @praeclarum ?

praeclarum commented 10 years ago

That looks a lot like a bug in the implementation to me.

There is a strange interaction with ACAccounts and the Store where you can't allow the accountStore to be freed so long as the ACAccount is in use, that's why I switched to the Field. I think I simply made a mistake leaving in that var store = new ....