Bug - Fixed locking familiar item in Gear Changer has issues.

Veracity

Developer
Staff member
It generates "Runnable in event dispatch thread".

Code:
class java.lang.Exception: Runnable in event dispatch thread
java.lang.Exception: Runnable in event dispatch thread
	at net.sourceforge.kolmafia.StaticEntity.printStackTrace(StaticEntity.java:361)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:277)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:243)
	at net.sourceforge.kolmafia.swingui.GearChangeFrame$FamLockCheckbox.actionPerformed(GearChangeFrame.java:1481)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
	at java.awt.Component.processMouseEvent(Component.java:6414)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
...
It's also a little funky in that I see this:

familiar is Leprechaun
change familiar item to lead necklace (a generic item)
check the "lock item" checkbox
change familiar item to Meat detector (a non-generic item)
the "lock item" checkbox greys out - but remains checked.
 

guyy

Member
There was a trivial update a few weeks ago that changed familiar equipment equipping to be "way less stupid". It looks like the lock button actually disappears when you equip something fam-specific and becomes unlocked. lockFamiliarItem in EquipmentManager, called when you change equipment (?), doesn't check for this:

Code:
        public static final void lockFamiliarItem()
	{
		EquipmentManager.lockFamiliarItem( EquipmentManager.familiarItemLocked() );
	}

	public static final boolean familiarItemLocked()
	{
		return EquipmentManager.lockedFamiliarItem != EquipmentRequest.UNEQUIP;
	}

Looks like that second function should do this:

Code:
return (EquipmentManager.lockedFamiliarItem != EquipmentRequest.UNEQUIP && EquipmentManager.familiarItemLockable());
 

Veracity

Developer
Staff member
Revision 14357 fixes the Runnable in Event Thread and all sorts of other weirdness. In my tests, we track the locked item successfully, leave the checkbox set or not depending on whether the current item really is locked, and enables or disables it based on whether the item is lockable.
 
Top