Just a recommendation: you should put a note in your code about that requirement otherwise there will likely be someone in the future (yourself included) that will wonder why there's that ! char there.
@JonB Thanks for your insight. I did as you suggested and found one of my local variable's address a nullptr(though not sure where it came from). I changed a few lines of code and apparently, my code works fine now. @Christian-Ehrlicher@J-Hilk thanks!
Variables declared at block scope with the specifier static or thread_local (since C++11) have static or thread (since C++11) storage duration but are initialized the first time control passes through their declaration (unless their initialization is zero- or constant-initialization, which can be performed before the block is first entered). On all further calls, the declaration is skipped.
So with the static keyword, getOpenFileName will only be called at the first time.
Thanks! I just realized that I should not have copy pasted that line of code without looking at it closer.
Not really. - I would start such program tracing only after a personal delay to notice that data processing for the function “QFileDialog::getOpenFileName” might take longer than what I would usually expect.
(I might be more patient under other circumstances.)
what you would see is the last line of output would "hang"
This did not happen. The dialogue software might be still busy with other stuff.
Additional activities might distract then from temporary technical difficulties.
just as you went into a "delay", and that would be your indication as to why....
I found questionable software behaviour also for other components in the suggested way so that corresponding clarification requests and bug reports were published.