MaskEdit is broken on GTK2
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
MaskEdit is broken on GTK2.
If you try to insert a char in the control an endless loop starts.
Steps to reproduce:
Place MaskEdit on a form
Set EditMask at runtime
Try to type in the control --> program freezes
Additional information:
All setting of text is by design done in SetInheritedText
This sets a flag (FChangeAllowed) to True, indicating it is OK to change the text in the control
Then it sets Inherited text
This triggers TextChanged to be called
In TextChanged the flag is inspected, and if changes are not allowed the text is reset (this is really necessary or the control might be screwed up by past.drag etc).
Then we return to SetInheritedText and the flag is set to False again
This code/feature is unchanged since r18192 (and was tested at the time on GTK1, GTK2 and Win32 and functioned as expected)
However now the order in which things happen have changed:
SetInheritedText is called
The flag is set to True
Inherited text is set
At this point TextChanged should be called, but it is not
The flag is set back to False
SetInheritedText is finished
And only now TextChanged is called, which will miserably fail, since the flag has been reset to False, and it will therefore try to reset the text to CurrentText
To achieve this it will call SetInheritedText(CurrentText) and an endless loop will follow.
So the order/timing in which events are called has changed, and TMaskEdit relies on that order.
Mantis conversion info:
- Mantis ID: 14615
- OS: Suse Linux
- OS Build: 10.0
- Build: 21739
- Platform: i386
- Version: 0.9.29 (SVN)
- Fixed in version: 0.9.29 (SVN)
- Fixed in revision: 21880 (#f914d86b)
- Monitored by: » luizamerico (Luiz Americo)
- Target version: 0.9.28