mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-08-22 12:00:25 +02:00
fix: prevent sefaults after progress bar tasks (#1490)
This commit is contained in:
committed by
GitHub
parent
4a3a767baf
commit
8275d3e74b
@@ -2,17 +2,23 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
|
||||
from collections.abc import Callable
|
||||
from typing import override
|
||||
|
||||
from PySide6.QtCore import QObject, QRunnable, Signal
|
||||
|
||||
|
||||
class CustomRunnable(QRunnable, QObject): # pyright: ignore[reportUnsafeMultipleInheritance]
|
||||
done = Signal()
|
||||
|
||||
def __init__(self, function) -> None:
|
||||
def __init__(self, function: Callable[..., None]) -> None:
|
||||
QRunnable.__init__(self)
|
||||
QObject.__init__(self)
|
||||
self.setAutoDelete(False)
|
||||
self.function = function
|
||||
|
||||
@override
|
||||
def run(self):
|
||||
self.function()
|
||||
self.done.emit()
|
||||
self.deleteLater()
|
||||
|
||||
Reference in New Issue
Block a user