Skip to content

get-focus-child always gives a newly allocated reference? #123

@lshoravi

Description

@lshoravi

Trying to compare two widgets for equal identity:

(define-method (split (container <GtkPaned>)
                      (orientation <symbol>))
  (let* ((focused (get-focus-child container))
         (setter (if (equal? focused (get-start-child container))
                     set-start-child
                     set-end-child)))
                     ...

However, the if-clause will always return #f, because get-focus-child seemingly always gives fresh references which hence are never eq? or equal?

    (display (get-focus-child container)) ; -> #<<GtkTextView> 7fc25c6e0e20>
    (display (get-focus-child container)) ; -> #<<GtkTextView> 7fc25c6e0b70>
    (display (get-focus-child container)) ; -> #<<GtkTextView> 7fc25c6e09b0>
    (display (eq? (get-focus-child container) (get-focus-child container)) ; -> #f

Is this a bug, or expected behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions