commit 3398a6068ab03748f1ef227f7f15dbc3cf66de7a
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Dec 8 23:58:32 2021 +0100

    Important bugfix

diff --git a/src/main/java/org/distorted/screens/RubikScreenPlay.java b/src/main/java/org/distorted/screens/RubikScreenPlay.java
index b71abce5..ae740b59 100644
--- a/src/main/java/org/distorted/screens/RubikScreenPlay.java
+++ b/src/main/java/org/distorted/screens/RubikScreenPlay.java
@@ -472,10 +472,30 @@ public class RubikScreenPlay extends RubikScreenBase
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
+// This is necessary! Otherwise the ObjectPopup will not be re-created next time and we will still
+// hold a reference to the old instance of the RubikActivity class (because setupObjectWindow is not
+// going to be called)
+// An reference to the old instance of RubikActivity will cause all sorts of strange issues.
 
   public void savePreferences(SharedPreferences.Editor editor)
     {
+    if( mObjectPopup!=null )
+      {
+      mObjectPopup.dismiss();
+      mObjectPopup = null;
+      }
 
+    if( mMenuPopup!=null )
+      {
+      mMenuPopup.dismiss();
+      mMenuPopup = null;
+      }
+
+    if( mPlayPopup!=null )
+      {
+      mPlayPopup.dismiss();
+      mPlayPopup = null;
+      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
