ListBoxMouseMoveSelector bug


#1

Hi Jules, hope you’re well.

I believe this is what is required to replicate a crash:

  1. set listbox->setMouseMoveSelectsRows(true);
  2. later on, once the listbox is visible, set listbox->setMouseMoveSelectsRows(false);

I inspected this a bit, and here’s what happens: an instance of ListBoxMouseMoveSelector mouse-listens to the listbox in its constructor, but after getting deleted with 2) the listbox tries to update its mouse listeners - modifying a freed object. So the quick fix is to add these lines at juce_ListBox:243:

~ListBoxMouseMoveSelector() {
owner.removeMouseListener(this);
}

and all is well.

Cheers
Daven


#2

Hi @Daven,

Thanks for the fix, I’ve added this to the develop branch.

Ed