processing / processing/processing4

dispose handlers not called when stop button pressed

Open
#631 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

opengl
Dominant language
Java
Stars
494
Forks
183
Avg merge
4h 39m
Merged PRs (30d)
3

Description

Created by: jdf

In the following sketch, the dispose handler is called when the escape key is pressed, but not when the stop button is pressed.

dispose_bug

SampleLibrary s;
void setup() {
  size(200, 200, P3D);
  s = new SampleLibrary(this);
}

void draw() {
  background(255);
  fill(0);
  text("" + millis(), 20, 20);
}

SampleLibrary.java

import processing.core.*;

public class SampleLibrary {

  public SampleLibrary(PApplet parent) {
    parent.registerMethod("dispose", this);
  }

  public void dispose() {
    System.err.println("disposed!");
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided dispose_bug sketch in Processing and compare pressing Escape with pressing the stop button. Trace the stop-button shutdown path and the registered dispose handler shown in SampleLibrary.java; done means the handler is called for both ways of stopping the sketch.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.