Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segmentation fault #1703

Merged
merged 3 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ v0.13.3 (unreleased)
* Fixed a bug related to callback functions when restoring sessions.
[#1695]

* Fixed a Qt-related segmentation fault that occurred during the
testing process and may also affect users. [#1703]

v0.13.2 (2018-05-01)
--------------------

Expand Down
12 changes: 8 additions & 4 deletions glue/external/echo/qt/autoconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,15 @@ def autoconnect_callbacks_to_qt(instance, widget, connect_kwargs={}):
if not hasattr(widget, 'children'):
return

for child in widget.findChildren(QtWidgets.QWidget):
full_name = child.objectName()
for original_name in dir(widget):
if original_name.startswith('_') or '_' not in original_name:
continue
# FIXME: this is a temorary workaround to allow multiple widgets to be
# connected to a state attribute.
if full_name.endswith('_'):
full_name = full_name[:-1]
if original_name.endswith('_'):
full_name = original_name[:-1]
else:
full_name = original_name
if '_' in full_name:
wtype, wname = full_name.split('_', 1)
if full_name in connect_kwargs:
Expand All @@ -106,4 +109,5 @@ def autoconnect_callbacks_to_qt(instance, widget, connect_kwargs={}):
kwargs = {}
if hasattr(instance, wname):
if wtype in HANDLERS:
child = getattr(widget, original_name)
HANDLERS[wtype](instance, wname, child, **kwargs)
5 changes: 0 additions & 5 deletions glue/viewers/common/qt/tests/test_data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
# registered Qt viewers.


def setup_function(func):
import os
os.environ['GLUE_TESTING'] = 'True'


class BaseTestDataViewer(object):

ndim = 1
Expand Down
1 change: 1 addition & 0 deletions glue/viewers/histogram/qt/options_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, viewer_state, session, parent=None):
fix_tab_widget_fontsize(self.ui.tab_widget)

autoconnect_callbacks_to_qt(viewer_state, self.ui)
autoconnect_callbacks_to_qt(viewer_state, self.ui.axes_editor.ui)

self.viewer_state = viewer_state

Expand Down
1 change: 1 addition & 0 deletions glue/viewers/image/qt/options_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, viewer_state, session, parent=None):
fix_tab_widget_fontsize(self.ui.tab_widget)

autoconnect_callbacks_to_qt(viewer_state, self.ui)
autoconnect_callbacks_to_qt(viewer_state, self.ui.axes_editor.ui)

self.viewer_state = viewer_state

Expand Down
1 change: 1 addition & 0 deletions glue/viewers/profile/qt/options_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(self, viewer_state, session, parent=None):
fix_tab_widget_fontsize(self.ui.tab_widget)

autoconnect_callbacks_to_qt(viewer_state, self.ui)
autoconnect_callbacks_to_qt(viewer_state, self.ui.axes_editor.ui)

self.viewer_state = viewer_state

Expand Down
1 change: 1 addition & 0 deletions glue/viewers/scatter/qt/options_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, viewer_state, session, parent=None):
fix_tab_widget_fontsize(self.ui.tab_widget)

autoconnect_callbacks_to_qt(viewer_state, self.ui)
autoconnect_callbacks_to_qt(viewer_state, self.ui.axes_editor.ui)

self.viewer_state = viewer_state

Expand Down