enthought / enthought/pyface

WxPython font dialog crashes after cancel

Open
#1,130 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
115
Forks
54
PR merge metrics
No merged PRs in 30d

Description

## Environment

OS: _all_
Python version: _3.6_
Toolkit:_Wx_

## Description

When using a FontDialog under Wx, when you cancel you get a crash with a traceback like this:
```
Traceback (most recent call last):
File "font_dialog.py", line 14, in
font = get_font(None, font='12 pt Helvetica sans-serif')
File "/Users/cwebster/src/process/pyface/pyface/font_dialog.py", line 37, in get_font
result = dialog.open()
File "/Users/cwebster/src/process/pyface/pyface/i_dialog.py", line 168, in open
self.close()
File "/Users/cwebster/src/process/pyface/pyface/ui/wx/font_dialog.py", line 51, in close
self.font = Font.from_toolkit(wx_font)
File "/Users/cwebster/src/process/pyface/pyface/font.py", line 354, in from_toolkit
return cls(**toolkit_font_to_properties(toolkit_font))
File "/Users/cwebster/src/process/pyface/pyface/ui/wx/font.py", line 160, in toolkit_font_to_properties
family = wx_family_to_generic_family[toolkit_font.GetFamily()]
wx._core.wxAssertionError: C++ assertion "IsOk()" failed at /Users/robind/projects/bb2/dist-osx-py36/build/ext/wxWidgets/src/common/fontcmn.cpp(407) in GetFamily(): invalid font
```

## Steps to Reproduce

Install a Wx environment, run examples/dialogs/font_dialog.py in it, and cancel the dialog when it is done.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.