isCurrentlyModal () bug?


#1

Hi Guys,

Checking at isCurrentlyModal () implementation, it only looks for the foremost component instead of all the modal component.
The implementation should probably check on all the modal component from getNumCurrentlyModalComponents ?

I’m troubleshooting some threaded loading command where there is a progress modal dialog and in some case I could have concurent loading leading to multiple modal dialog box.

Thx


#2

Hmm, it’s a badly chosen name really… Maybe a better name would have been “isCurrentlyTheModalComponent”, which describes the intention of this method.

We can’t change this kind of thing though, it’d break existing code that relies on the current behaviour.


#3

I don’t mind but exitModalState impl relies on it and hence do not work correctly if there are multiple modal dialog overlapping.
So internal code should probably not use it.


#4

Changing the implementation to check all the modal component fixed my crash.
You can maybe add a parameter
bool onlyCheckforemost
to isCurrentlyModal
and set it to false in calls of juce_component.cpp and juce_threadWithProgressWindow.cpp
and have it default to true.

Thanks !


#5

Do you think this is possible to do Jules ?


#6

Sorry, been busy… Yes, sounds like something we should look into!


#7

bumpity bump


#8

OK this should be fixed on the develop branch.


#9

Many Thanks !