View Issue Details

IDProjectCategoryView StatusLast Update
0000713OpenMPT[All Projects] User Interfacepublic2017-10-02 13:45
ReportermanxAssigned To 
PriorityhighSeveritymajorReproducibilityalways
Status newResolutionopen 
Platformx86 / x64OSWineOS Version(version plz)
Product VersionOpenMPT 1.25.02.* (old testing) 
Target VersionOpenMPT 1.?? (long term goals)Fixed in Version 
Summary0000713: KeyboardHook can ultimately invoke a message loop which can cause re-entry to the hook function
Description

Wine will loop re-entering the keyboard hook and re-process the hotkey, ultimately resulting in resource exhaustion and hang or crash, when the hotkey results in displaying a modal dialog window.

Steps To Reproduce

On Wine, invoke a keyboard hotkey that results in a modal dialog window being created (simple example: Ctrl-F in the pattern editor).

Additional Information

Keyboard hooks are processed right before a keyboard-related message is about to be delivered. When the handling in the hook function ultimately can invoke its own message loop, the same message is again in the state of being about to be delivered.
MSDN does not explicitly state the required behaviour in case of hook function re-entry. Native Windows appears to avoid re-entry, Wine just calls the hook again from deep down inside its own stack frame, which causes the problem.

TagsNo tags attached.
Has the bug occurred in previous versions?yes
Tested code revision (in case you know it)

Relationships

related to 0000783 new cross-platform OpenMPT 
related to 0000857 resolvedSaga Musix More than one desired window get opened with certain key shortcuts 
related to 0001037 resolvedmanx Dialogs do not allow keyboard input when invoked via a keyboard shortcut 

Activities

manx

manx

2015-09-30 16:39

administrator   ~0002151

A work-around for Wine has been applied in r5636. It just guards against re-entry of the keyboard hook function.

manx

manx

2017-09-22 15:19

administrator   ~0003231

In general, I think in the long run, OpenMPT should move to explicit per Windows global keyboard handling instead of installing an actual global handler. That would also be way more portable to other GUI environments, thus the related issue 0000783.

manx

manx

2017-09-29 16:48

administrator   ~0003271

Invoking a File Dialog on Wine (Linux, OSX behaviour is unknown) using a keyboard hotkey does not allow editing the filename edit control. This is caused by this very issue (verified by hacking-in async invocation of the keyboard hook input handler (which fixes the issue)).

Originally reported by hicoleri on IRC.

Issue History

Date Modified Username Field Change
2015-09-30 11:03 manx New Issue
2015-09-30 16:39 manx Note Added: 0002151
2016-08-08 17:47 manx Relationship added related to 0000857
2017-09-22 15:17 manx Relationship added related to 0000783
2017-09-22 15:19 manx Note Added: 0003231
2017-09-29 16:48 manx Note Added: 0003271
2017-10-02 13:45 manx Relationship added related to 0001037