-
Notifications
You must be signed in to change notification settings - Fork 7
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 segfault in test #128
Fix segfault in test #128
Changes from 8 commits
756aade
7005429
3940ad1
d04c1d7
910e67d
a8d498d
0b07ff9
f1457d0
e1bdffd
8ac2fcd
8c9ffe7
b351dff
090b27a
a2d0889
266f181
d74d313
aa229a5
c281edb
31652d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,6 +230,12 @@ def dataShape(self) -> tuple[int, int]: | |
def dataShapeRaw(self) -> tuple[int, int]: | ||
return self.getDataFrame().shape | ||
|
||
def connectItemChangedSignal(self, *args, **kwargs) -> None: | ||
pass | ||
|
||
def disconnectItemChangedSignal(self): | ||
pass | ||
|
||
def zoom(self) -> float: | ||
"""Get current zoom factor.""" | ||
return self._qtable_view.zoom() | ||
|
@@ -1222,6 +1228,13 @@ def connectItemChangedSignal( | |
self.evaluatedSignal.connect(slot_eval) | ||
return None | ||
|
||
def disconnectItemChangedSignal(self): | ||
self.itemChangedSignal.disconnect() | ||
self.rowChangedSignal.disconnect() | ||
self.columnChangedSignal.disconnect() | ||
self.evaluatedSignal.disconnect() | ||
return None | ||
Comment on lines
+1231
to
+1236
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The def disconnectItemChangedSignal(self):
for signal in [self.itemChangedSignal, self.rowChangedSignal, self.columnChangedSignal, self.evaluatedSignal]:
try:
signal.disconnect()
except TypeError:
pass
return None |
||
|
||
def keyPressEvent(self, e: QtGui.QKeyEvent): | ||
keys = QtKeys(e) | ||
if not self._keymap.press_key(keys): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -485,6 +485,9 @@ def paste_data( | |
|
||
def close(self): | ||
"""Close the viewer.""" | ||
for table in self.tables: | ||
table.native.disconnectItemChangedSignal() | ||
self.tables.clear() | ||
return self._qwidget.close() | ||
|
||
@property | ||
|
@@ -581,6 +584,21 @@ def _pass_pytable(src, index: int, dst): | |
_tablist.events.changed.connect(self.reset_choices) | ||
_tablist.events.renamed.connect(self.reset_choices) | ||
|
||
def _unlink_events(self): | ||
_tablist = self.tables | ||
_qtablist = self._qwidget._tablestack | ||
|
||
_tablist.events.inserted.disconnect() | ||
_tablist.events.removed.disconnect() | ||
_tablist.events.moved.disconnect() | ||
_tablist.events.renamed.disconnect() | ||
|
||
_qtablist.itemMoved.disconnect() | ||
_qtablist.tableRenamed.disconnect() | ||
_qtablist.tableRemoved.disconnect() | ||
_qtablist.tablePassed.disconnect() | ||
_qtablist.itemDropped.disconnect() | ||
Comment on lines
+587
to
+600
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
|
||
class TableViewerWidget(TableViewerBase): | ||
"""The non-main table viewer widget.""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import pytest | ||
from weakref import WeakSet | ||
import gc | ||
|
||
@pytest.fixture | ||
def make_tabulous_viewer(qtbot): | ||
|
@@ -15,14 +16,16 @@ def factory(show=False): | |
yield factory | ||
|
||
for viewer in viewers: | ||
viewer._unlink_events() | ||
viewer.close() | ||
viewer.native.deleteLater() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The - viewer.native.deleteLater()
+ if hasattr(viewer, 'native'):
+ viewer.native.deleteLater() |
||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def session(): | ||
from tabulous._utils import init_config, update_config, get_config | ||
from tabulous._qt._mainwindow import QMainWindow | ||
import gc | ||
from qtpy.QtWidgets import QApplication | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import statement for - from qtpy.QtWidgets import QApplication
+from qtpy.QtWidgets import QApplication |
||
|
||
with init_config(): | ||
cfg = get_config() | ||
|
@@ -41,7 +44,11 @@ def session(): | |
instance.close() | ||
instance.deleteLater() | ||
|
||
QApplication.closeAllWindows() | ||
QMainWindow._instances.clear() | ||
N_PROCESS_EVENTS = 50 | ||
for _ in range(N_PROCESS_EVENTS): | ||
QApplication.processEvents() | ||
gc.collect() | ||
if QMainWindow._instances: | ||
raise RuntimeError("QMainWindow instances not cleaned up!") | ||
QMainWindow._instances.clear() |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
connectItemChangedSignal
anddisconnectItemChangedSignal
methods are defined but do not perform any operations. If these methods are intended to be overridden in subclasses, consider making them abstract methods or adding a comment to clarify their purpose.