View Issue Details

IDProjectCategoryView StatusLast Update
0000713OpenMPTUser Interfacepublic2024-09-19 12:32
Reportermanx Assigned ToSaga Musix  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86 / x64OSWineOS Version(version plz)
Product VersionOpenMPT 1.25.02.* (old testing) 
Target VersionOpenMPT 1.32 / libopenmpt 0.8 (goals)Fixed in VersionOpenMPT 1.32 / libopenmpt 0.8 (goals) 
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.

manx

manx

2018-10-20 16:53

administrator   ~0003675

This also breaks assigning keyboard shortcuts in Wine when the settings window was itself invoked via a hotkey itself.

Saga Musix

Saga Musix

2024-09-19 12:31

administrator   ~0006061

Changes in r21616:

  • Global shortcut handling is now moved to PreTranslateMessage in new DialogBase class or wherever else it's needed.
  • Behaviour change: Global shortcuts no longer work when a menu or context menu is open.
  • Note that the keyboard hook is still present to catch modifier changes, but as it no longer handles the shortcuts itself, the reentrancy problem observed on Wine is gone.

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
2018-10-20 16:53 manx Note Added: 0003675
2022-10-30 19:53 manx Relationship added related to 0001634
2022-11-01 16:59 Saga Musix Relationship deleted related to 0001634
2024-09-16 14:08 manx Relationship added related to 0001815
2024-09-17 22:27 Saga Musix Relationship deleted related to 0001815
2024-09-19 12:29 Saga Musix Assigned To => Saga Musix
2024-09-19 12:29 Saga Musix Status new => assigned
2024-09-19 12:31 Saga Musix Note Added: 0006061
2024-09-19 12:32 Saga Musix Status assigned => resolved
2024-09-19 12:32 Saga Musix Resolution open => fixed
2024-09-19 12:32 Saga Musix Fixed in Version => OpenMPT 1.32 / libopenmpt 0.8 (goals)
2024-09-19 12:32 Saga Musix Target Version OpenMPT 1.?? (long term goals) => OpenMPT 1.32 / libopenmpt 0.8 (goals)