Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-6024

BM_CLICK is not protected against recursive calls

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.3.17
    • Win32SS
    • None
    • Operating System: ReactOS
      Platform: x86 Hardware

    Description

      Created an attachment (id=6968)
      Sample program demonstrating bug in BM_CLICK handling

      The BM_CLICK message translates into a WM_LBUTTONDOWN and a WM_LBUTTONUP message being sent to the button. These messages result in a BN_CLICKED notification.
      On MS Windows, sending a BM_CLICK message has no effect while handling the WM_LBUTTONDOWN message that comes from another BM_CLICK message. On ReactOS (and Wine) this results in nested WM_LBUTTONDOWN messages and BN_CLICKED notifications.

      I've attached a simple program that demonstrates this behavior. It creates a window with a button. The button is subclassed to intercept WM_LBUTTONDOWN. When clicking the button, it starts counting the BN_CLICKED notifications and sends a BM_CLICK message. After this message it displays the number of received BN_CLICKED notifications. When the button receives a WM_LBUTTONDOWN message and the test is currently running, the sample sends a new BM_CLICK message.
      I've also implemented a check to definitly stop sending BM_CLICK after a while, so the program doesn't loop forever.

      On MS Windows the sample always counts exactly 1 BN_CLICKED notification. On ReactOS it always runs until the check for the endless loop fires and counts more than 1 BN_CLICKED notification.

      I suggest to extend the BM_CLICK handler in the button control like this:
      if(!inBMClick) {
      inBMClick = TRUE;
      SendMessage(WM_LBUTTONDOWN);
      SendMessage(WM_LBUTTONUP);
      inBMClick = FALSE;
      }

      Attachments

        Activity

          People

            bug zilla Bug Zilla
            tiku TiKu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: