Skip to content

Calls to unregisterMethod may not work #223

Closed
@processing-bot

Description

@processing-bot

Created by: WhiteSte

I'm referring to #199, i'm using the last version (4.05a)

Description

I'm supposing that the method unregisterMethod from PApplet class is not working at all.

Expected Behavior

After loading a method inside PApplet it should be removed.

Current Behavior

Methods seems to me that are not removed.

Steps to Reproduce

SKETCH

TestObject test;
  
  void setup() {
    test = new TestObject(this, "object 1");
    test.remove();
}
  
  void draw() {
    if (frameCount == 10) {
      exit();
    }
  }

CLASS

public class TestObject {
  
    private PApplet parent;
    private String name;
    private boolean flag = false;
  
    public TestObject(PApplet parent, String name) {
      this.parent = parent;
      this.name = name;
      parent.registerMethod("post", this);
    }
  
    public void post() {
      if (flag == true) System.out.println("You should have removed this Method");
      System.out.println("Running: " + name);
      this.remove(); // That should stop spamming in console
      flag = true;
}
  public void remove(){
    System.out.println("Removing: " + name);
    parent.unregisterMethod("post", name);
  }
}

Your Environment

  • Processing version: 4.05alpha
  • Operating System and OS version: Mac os latest version Big Sur 11.4
  • Other information:

Possible Causes / Solutions

I saw that a modification to this method was made some weeks ago, maybe that's the cause

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions