| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,6 +61,7 @@ public class Client implements Runnable { | |||
| 61 | 61 | int bufferIndex; | |
| 62 | 62 | int bufferLast; | |
| 63 | 63 | ||
| 64 | + boolean isDisposeRegistered = false; | ||
| 64 | 65 | ||
| 65 | 66 | /** | |
| 66 | 67 | * @param parent typically use "this" | |
@@ -81,6 +82,7 @@ public Client(PApplet parent, String host, int port) { | |||
| 81 | 82 | thread.start(); | |
| 82 | 83 | ||
| 83 | 84 | parent.registerMethod("dispose", this); | |
| 85 | + isDisposeRegistered = true; | ||
| 84 | 86 | ||
| 85 | 87 | // reflection to check whether host sketch has a call for | |
| 86 | 88 | // public void clientEvent(processing.net.Client) | |
@@ -158,6 +160,9 @@ public void stop() { | |||
| 158 | 160 | disconnectEventMethod = null; | |
| 159 | 161 | } | |
| 160 | 162 | } | |
| 163 | + if(isDisposeRegistered){ | ||
| 164 | + parent.unregisterMethod("dispose", this); | ||
| 165 | + } | ||
| 161 | 166 | dispose(); | |
| 162 | 167 | } | |
| 163 | 168 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments