Giter Site home page Giter Site logo

Comments (5)

niltsiar avatar niltsiar commented on July 23, 2024 2

Just from that trace I think the problem may be that you are registering some Connectable while some network change is being notified to the ones previously registered. Could you provide some example to look further?

from merlin.

Mecharyry avatar Mecharyry commented on July 23, 2024 2

Given that it comes from a PingTask it seems unlikely that this code is at fault. As you said @EBfVince you have just copied the demo. It seems that this could happen should a ping task callback when attempting to clear the registrations when unbinding merlin.

from merlin.

niltsiar avatar niltsiar commented on July 23, 2024 2

Yes, it seems that the underlying connectable collection could be modified while notifying those Connectable and it causes the mentioned Exception. I've tried to create a test for such condition and a possible fix for that.

from merlin.

EBfVince avatar EBfVince commented on July 23, 2024

My class using Merlin :

public class ManageInternet implements LoaderManager.LoaderCallbacks<Boolean>,
        Connectable, Disconnectable {

    // ...

    private final Merlin merlin;
    private final MerlinsBeard merlinsBeard;
    
    // ...

    public ManageInternet(@NonNull MyActivity activity) {

        // INTERNET Merlin
        this.merlin = new Merlin.Builder()
                .withConnectableCallbacks()
                .withDisconnectableCallbacks()
                .build(vinceActivity2);
        this.merlin.registerConnectable(this);
        this.merlin.registerDisconnectable(this);
        this.merlinsBeard = MerlinsBeard.from(activity);

       // ...

    }

    // ...

   public void bindMerlin() {
        merlin.bind();
        if (merlinsBeard.isConnected())
            onConnect();
        else
            onDisconnect();
    }

    public void unbindMerlin() {
        merlin.unbind();
        internetStateChanged = true;
    }

   ...

}

In my activity class :

public abstract class MyActivity extends AppCompatActivity {

    // ...

    private ManageInternet mi;

    @Override
    @CallSuper
    protected void onCreate(@Nullable Bundle savedInstanceState) {

        // ...

        // INTERNET
        mi = new ManageInternet (this);

        // ...

    }

    @Override
    @CallSuper
    protected void onResume() {

        super.onResume();

        // INTERNET (désabonne dans le onPause())
        gl.bindMerlin();

    }

    @Override
    @CallSuper
    protected void onPause() {

        // INTERNET
        gl.unbindMerlin();

        super.onPause();

    }

}

"MyActivity" is the abstract class that all my other activities depend.
"ManageInternet" helps to load data from internet when the connection is available.

This error is not critical, I just had one crash few days ago on one of my users.
On firebase, crashlytics doest not give me informations about where my code launched your code.
I will give you more informations in the future if this error raise again.

from merlin.

niltsiar avatar niltsiar commented on July 23, 2024

This should be already fixed in #183

from merlin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.