11 Commits

Author SHA1 Message Date
Ryan Volz
a1288a8f3f grc: Fix cairo assertion failure by not storing reference to context.
The connection flowgraph element previously kept a reference to the
cairo context passed to the draw function in order to be able to use
cairo's `in_stroke` function to determine if the mouse cursor was on the
path of the curved connection line. As it turns out, this is dangerous
because GTK is constantly destroying and creating new cairo contexts
and surfaces.

This avoids keeping a reference to the cairo context by initializing a
local cairo context with the connection class for the sole purpose of
storing the curved path and calculating `in_stroke`. The local context
and surface can be very basic because not much is needed for
`in_stroke`, and the context can persist and just have its path replaced
when it needs to be updated.

On Windows, resizing the GRC window (and particularly the flowgraph
canvas) to a larger size than its initial size would cause the
underlying cairo surface to be destroyed and a new one created. The
cairo context stored for the curved connection line had a reference to
that destroyed surface, and closing that context (upon replacing it with
a new one) would attempt decrement the reference count on the surface.
This would produce an assertion failure that crashed GRC stating
`Assertion failed: CAIRO_REFERENCE_COUNT_HAS_REFERENCE
(&surface->ref_count)`.

On macOS with the Quartz backend, a related crash and assertion error
would manifest when connecting blocks.

Signed-off-by: Ryan Volz <ryan.volz@gmail.com>
2022-11-17 12:58:31 -05:00
Josh Morman
b7828c950c grc: pep8 formatting
Signed-off-by: Josh Morman <jmorman@gnuradio.org>
2021-11-24 14:41:53 -05:00
Oleksandr Kravchuk
43e6a43e3d python: Remove unnecessary 'from __future__ import'
All of the removed `from __future__ import` were needed in older
versions of Python (mostly 2.5.x and below) but later became mandatory
in most versions of Python 3 hence are not necessary anymore.

More specifically, according to __future__.py[1]:
- unicode_literals is part of Python since versions 2.6.0 and 3.0.0;
- print_function is part of Python since versions 2.6.0 and 3.0.0;
- absolute_import is part of Python since versions 2.5.0 and 3.0.0;
- division is part of Python since versions 2.2.0 and 3.0.0;

Get rid of those unnecessary imports to slightly clean up the codebase.

[1] https://github.com/python/cpython/blob/master/Lib/__future__.py
2020-08-03 11:40:27 +02:00
devnulling
9a453c2ca6 Update license header to SPDX format 2020-01-27 19:56:21 -08:00
Josh Morman
914cacfebd grc: add busports back into 3.8
Bus ports had not been added back in since the refactor of grc
Hopefully this fully enables busports though there are still some
issues with the gr-fec flowgraphs

Fixes #2277
2019-07-15 21:48:10 +02:00
Sebastian Koslowski
113d266349 grc: added yaml/mako support
Includes basic converter from XML/Cheetah to YAML/Mako based block format.
2017-06-29 09:16:49 -07:00
Sebastian Koslowski
7db5091a84 grc: fix regressions from gtk3 merge 2017-03-22 14:18:58 +01:00
Sebastian Koslowski
ce3e4890bd grc: gtk3: drag to connect 2017-01-11 21:33:29 +01:00
Sebastian Koslowski
498ed37834 grc: gtk3: invalid connection all red 2017-01-11 21:33:29 +01:00
Sebastian Koslowski
269aad01b0 grc: gtk3: curved connections 2017-01-11 21:33:25 +01:00
Sebastian Koslowski
423d320040 grc: refactor: move drawables in subpackage 2016-09-13 11:54:56 -06:00