Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Error when clicking on menus after (setf frame-command-table) #1312

Open
john-a-carroll opened this issue Sep 13, 2022 · 0 comments
Open

Error when clicking on menus after (setf frame-command-table) #1312

john-a-carroll opened this issue Sep 13, 2022 · 0 comments

Comments

@john-a-carroll
Copy link
Contributor

After executing (setf frame-command-table) from a menu command, clicking on another menu in the frame can result in an error (apparently while McCLIM is attempting to 'arm' that menu button).

Here's a test case:

(in-package :clim-user)

(define-application-frame menutest ()
    ()
  (:pane :application))

(define-command-table file-command-table
                      :menu (("Expand menus" :command com-expand)
                             ("Run" :command com-run)
                             ("Quit" :command com-quit)))

(define-command-table edit-command-table
                      :menu (("Edit 1" :command com-edit-1)
                             ("Edit 2" :command com-edit-2)))

(define-command-table view-command-table
                      :menu (("View 1" :command com-view-1)
                             ("View 2" :command com-view-2)))

(make-command-table 'menutest
                    :inherit-from '(global-command-table)
                    :menu '(("File" :menu file-command-table)
                            ("Edit" :menu edit-command-table))
                    :errorp nil)

(define-menutest-command com-run ()
  (format t "~&Running...") (force-output)
  (sleep 5))

(define-menutest-command com-quit ()
  (frame-exit *application-frame*))

(define-menutest-command com-expand ()
  (make-command-table 'menutest
                      :inherit-from '(global-command-table)
                      :menu '(("File" :menu file-command-table)
                              ("Edit" :menu edit-command-table)
                              ("View" :menu view-command-table))
                      :errorp nil)
  (add-command-to-command-table 'com-run 'menutest)
  (add-command-to-command-table 'com-expand 'menutest)
  (add-command-to-command-table 'com-quit 'menutest)
  (setf (frame-command-table *application-frame*) (find-command-table 'menutest)))

(run-frame-top-level (make-application-frame 'menutest))

Evaluate these forms, and then in the Menutest frame select the command File > Expand menus. This adds an extra menu to the menu bar. Then select the command File > Run, and during the next 5 seconds while the command is running, click on one of the other two menu buttons (Edit or View). As soon as the 5 seconds is up, there's an error:

debugger invoked on a SB-PCL::NO-APPLICABLE-METHOD-ERROR in thread
#<THREAD "main thread" RUNNING {10014E4073}>:
  There is no applicable method for the generic function
    #<STANDARD-GENERIC-FUNCTION CLIM:SHEET-CHILDREN (5)>
  when called with arguments
    (NIL).

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10014E4073}>
0: ((:METHOD NO-APPLICABLE-METHOD (T)) #<STANDARD-GENERIC-FUNCTION CLIM:SHEET-CHILDREN (5)> NIL) [fast-method]
1: (SB-PCL::CALL-NO-APPLICABLE-METHOD #<STANDARD-GENERIC-FUNCTION CLIM:SHEET-CHILDREN (5)> (NIL))
2: ((:METHOD CLIM-INTERNALS::ARM-MENU-BUTTON-CALLBACK (MENU-BUTTON-PANE)) #<CLIM-CLX::|CLX-856-CLIM-INTERNALS:MENU-BUTTON-SUBMENU-PANE| NIL {1004EE3EB3}>) [fast-method]
3: ((:METHOD CLIM-INTERNALS::ARM-MENU-BUTTON-CALLBACK (CLIM-INTERNALS::MENU-BUTTON-SUBMENU-PANE)) #<CLIM-CLX::|CLX-856-CLIM-INTERNALS:MENU-BUTTON-SUBMENU-PANE| NIL {1004EE3EB3}>) [fast-method]
4: (CLIM-INTERNALS::INVOKE-CALLBACK #<CLIM-CLX::|CLX-856-CLIM-INTERNALS:MENU-BUTTON-SUBMENU-PANE| NIL {1004EE3EB3}> CLIM-INTERNALS::ARM-MENU-BUTTON-CALLBACK)
5: ((SB-PCL::EMF ARMED-CALLBACK) #<unused argument> #<unused argument> #<CLIM-CLX::|CLX-856-CLIM-INTERNALS:MENU-BUTTON-SUBMENU-PANE| NIL {1004EE3EB3}> #<MENUTEST {1003F18023}> #:GADGET929)
6: ((FLET "POINTER-BUTTON-RELEASE5" :IN CLIM-INTERNALS::START-MENU-BAR) :WINDOW #<CLIM-CLX::|CLX-856-CLIM-INTERNALS:MENU-BUTTON-SUBMENU-PANE| NIL {1004EE3EB3}>)
7: ((LABELS CLIM-INTERNALS::DO-IT :IN CLIM-INTERNALS::INVOKE-TRACKING-POINTER))
8: (CLIM-INTERNALS::INVOKE-TRACKING-POINTER #<CLIM-INTERNALS::TRACKING-POINTER-STATE {10037CA353}>)
9: (CLIM-INTERNALS::START-MENU-BAR #<CLIM-CLX::|CLX-856-CLIM-INTERNALS:HMENU-PANE| NIL {1005B98513}> #<CLIM-CLX::|CLX-856-CLIM-INTERNALS:MENU-BUTTON-SUBMENU-PANE| NIL {1009F09B43}>)
10: ((:METHOD STREAM-INPUT-WAIT (CLIM-INTERNALS::INPUT-STREAM-KERNEL)) #<CLIM-CLX::|CLX-856-CLIM:APPLICATION-PANE| CLIM-INTERNALS::SINGLE-PANE {1009B0D9A3}> :TIMEOUT NIL :INPUT-WAIT-TEST #<FUNCTION CLIM-INTERNALS::INPUT-CONTEXT-WAIT-TEST>) [fast-method]
11: ((:METHOD STREAM-READ-GESTURE (CLIM-INTERNALS::INPUT-STREAM-KERNEL)) #<CLIM-CLX::|CLX-856-CLIM:APPLICATION-PANE| CLIM-INTERNALS::SINGLE-PANE {1009B0D9A3}> :TIMEOUT NIL :PEEK-P NIL :INPUT-WAIT-TEST #<FUNCTION CLIM-INTERNALS::INPUT-CONTEXT-WAIT-TEST> :INPUT-WAIT-HANDLER #<FUNCTION CLIM-INTERNALS::INPUT-CONTEXT-EVENT-HANDLER> :POINTER-BUTTON-PRESS-HANDLER #<FUNCTION CLIM-INTERNALS::INPUT-CONTEXT-BUTTON-PRESS-HANDLER>) [fast-method]
12: ((:METHOD STREAM-READ-GESTURE (STANDARD-EXTENDED-INPUT-STREAM)) #<CLIM-CLX::|CLX-856-CLIM:APPLICATION-PANE| CLIM-INTERNALS::SINGLE-PANE {1009B0D9A3}> :TIMEOUT NIL :PEEK-P NIL :INPUT-WAIT-TEST #<FUNCTION CLIM-INTERNALS::INPUT-CONTEXT-WAIT-TEST> :INPUT-WAIT-HANDLER #<FUNCTION CLIM-INTERNALS::INPUT-CONTEXT-EVENT-HANDLER> :POINTER-BUTTON-PRESS-HANDLER #<FUNCTION CLIM-INTERNALS::INPUT-CONTEXT-BUTTON-PRESS-HANDLER>) [fast-method]

Here's a screenshot of the state of the frame at this point:

Screenshot 2022-09-13 at 14 24 01

I wish I could suggest a fix for this issue, but I'm afraid I can't work out how menu arming is supposed to work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant