knewfilemenu: Avoid running multiple nameJobs while creating a directory
This is a fix for a bug where in network views, pressing Ctrl+Shift+N
multiple times opens multiple popup windows and thus causes a crash when any of the popups is interacted with after closing the topmost one.
In regular views this works fine,
since the nameJob
does not take long time at all and only one popup opens, immediately blocking the shortcut.
In network views, the nameJob
seems to take a while to run, since it's loading info from network. If user spams Ctrl+Shift+N
shortcut in frustration, it starts more nameJob
s and eventually when those jobs are done, it opens multiple popups.
This code changes that there's only one nameJob
for the createDirectory
. We check if there's one running, and if not, we start a new one. When it's done, we clear up the m_nameJob
to let new one through. Any following shortcut presses do nothing, until the namejob and thus the popup is done.
I've tested that it works in both network and regular Dolphin views.