racket / racket/gui

Specify the behavior of hierarchical-list-compound-item<%>:open if its parent is not open

Open
#145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
68
Forks
82
PR merge metrics
No merged PRs in 30d

Description

Version

Racket 7.4 on Debian 9.

How to reproduce

Save this in hierlist-error.rkt:

#lang racket/base

;;  hierlist-error.rkt

(require
    racket/class
    racket/gui/base
    mrlib/hierlist
)

(provide
    main
)

(define (main)
    (define frame (new frame% [label "hierlist-error.rkt"] [width 800] [height 600]))
    (define hlist (new hierarchical-list% [parent frame]))
    (define hcompound-1 (send hlist new-list))
    (define hcompound-1-1 (send hcompound-1 new-list))
    ;;  This throws an exception.
    (send hcompound-1-1 open)
    (send frame show #t)
)

Then, run:

racket -t hierlist-error.rkt -m

We get this NullPointerException:

end: target is not an object
  target: #f
  method name: get-text-extent
  context...:
   racket-7.4/share/pkgs/gui-lib/mrlib/arrow-toggle-snip.rkt:161:4: set-state method in arrow-toggle-snip%
   racket-7.4/share/pkgs/gui-lib/mrlib/hierlist/hierlist-unit.rkt:479:13: handle-open method in hierarchical-list-snip%

Expected behavior

I expect hcompound-1-1 to change its internal state to open, so that when its parent is opened, it will be open by default.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with racket -t hierlist-error.rkt -m, then inspect arrow-toggle-snip.rkt and hierlist-unit.rkt at the stack-trace locations. Confirm the intended state transition for opening a child whose parent is closed, and verify that opening the parent later reflects that state without raising the reported exception.

Written by the indexing model from the issue text.

Assessment

Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.