This PR changes the PainterThread to use WeakReference. This ensure that the paintable can be garbage collected without the painter thread intervening.
The PR also adds a unit test to ensure that the garbage collection works as expected.
Additionally notify() is replaced with notifyAll(). It doesn't make a difference in our case. But notifyAll() is the preferred method to use because it more reliable wakes up the waiting threads.
This PR changes the PainterThread to use WeakReference. This ensure that the paintable can be garbage collected without the painter thread intervening.
The PR also adds a unit test to ensure that the garbage collection works as expected.
Additionally notify() is replaced with notifyAll(). It doesn't make a difference in our case. But notifyAll() is the preferred method to use because it more reliable wakes up the waiting threads.