After my plugin grabs keyboard focus (by either opening a save/load dialog, or a combobox popupmenu) if I press a QWERTY key the program freezes. It's getting stuck in one of the for loops of the handleKeyPress method:
The target->keyPressed call that occurs halfway through the method isn't implemented in any of my components, so they're always returning false. So as a workaround I've been implementing keyPressed in all of my relevant components and having them return true, which in turn breaks the for loop. While this works, I feel like I'm plugging holes in a leaky boat, when I should be trying to stop the cause of the leaks in the first place (weak metaphor?). Any suggestions?
Huh? It's impossible for that for-loop to get stuck - it'll just go up the component's parent hierarchy, then stop, regardless of what your keyPressed method returns.
Once it freezes, I place a breakpoint in that loop and it stops the debugger. It doesn't matter how long I wait before inserting the breakpoint, it always stops in that loop calling the keyPress method over and over again. I've pressed "continue" in visual over and over and it doesn't leave the loop. And the only way I can get it to stop is by returning true from keyPress. Here's the stack:
> Primer.dll!juce::ComponentPeer::handleKeyPress(int keyCode, unsigned int textCharacter) Line 182 C++
Primer.dll!juce::HWNDComponentPeer::doKeyChar(int key, const __int64 flags) Line 2022 C++
Primer.dll!juce::HWNDComponentPeer::peerWindowProc(HWND__ * h, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2349 C++
Primer.dll!juce::HWNDComponentPeer::windowProc(HWND__ * h, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2211 C++
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!CallWindowProcW() Unknown
Ableton Live 8.exe!0000000001a0d6ad() Unknown
Ableton Live 8.exe!0000000001a0fd53() Unknown
Ableton Live 8.exe!0000000001a0ff13() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchClientMessage() Unknown
user32.dll!__fnINWPARAMDBCSCHAR() Unknown
ntdll.dll!KiUserCallbackDispatcherContinue() Unknown
user32.dll!NtUserMessageCall() Unknown
user32.dll!fnINWPARAMDBCSCHAR() Unknown
user32.dll!SendMessageWorker() Unknown
user32.dll!SendMessageA() Unknown
Primer.dll!`anonymous namespace'::keyboardHookCallback(int nCode, unsigned __int64 wParam, __int64 lParam) Line 228 C++
user32.dll!DispatchHookA() Unknown
user32.dll!CallHookWithSEH() Unknown
user32.dll!__fnHkINLPMSG() Unknown
ntdll.dll!KiUserCallbackDispatcherContinue() Unknown
user32.dll!NtUserPeekMessage() Unknown
user32.dll!_PeekMessage() Unknown
user32.dll!PeekMessageW() Unknown
mfc90u.dll!CWinThread::Run(void) Unknown
mfc90u.dll!AfxWinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,wchar_t *,int) Unknown
Ableton Live 8.exe!0000000001d6db5e() Unknown
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown