mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
set up fault handler
This commit is contained in:
parent
c17b0650b0
commit
9f28d5a638
1 changed files with 10 additions and 0 deletions
10
aqt/main.py
10
aqt/main.py
|
@ -7,6 +7,7 @@ import signal
|
||||||
import zipfile
|
import zipfile
|
||||||
import gc
|
import gc
|
||||||
import time
|
import time
|
||||||
|
import faulthandler
|
||||||
|
|
||||||
from send2trash import send2trash
|
from send2trash import send2trash
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
|
@ -66,6 +67,7 @@ class AnkiQt(QMainWindow):
|
||||||
|
|
||||||
def setupUI(self):
|
def setupUI(self):
|
||||||
self.col = None
|
self.col = None
|
||||||
|
self.setupCrashLog()
|
||||||
self.setupAppMsg()
|
self.setupAppMsg()
|
||||||
self.setupKeys()
|
self.setupKeys()
|
||||||
self.setupThreads()
|
self.setupThreads()
|
||||||
|
@ -1165,6 +1167,14 @@ Please ensure a profile is open and Anki is not busy, then try again."""),
|
||||||
def _onCollect(self):
|
def _onCollect(self):
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
|
# Crash log
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
def setupCrashLog(self):
|
||||||
|
p = os.path.join(self.pm.base, "crash.log")
|
||||||
|
self._crashLog = open(p, "a")
|
||||||
|
faulthandler.enable(self._crashLog)
|
||||||
|
|
||||||
# Media server
|
# Media server
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# prevent malicious decks from accessing the local filesystem
|
# prevent malicious decks from accessing the local filesystem
|
||||||
|
|
Loading…
Reference in a new issue