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

Crash when opening the snippet editor #50

Open
xusheng6 opened this issue Mar 26, 2024 · 2 comments
Open

Crash when opening the snippet editor #50

xusheng6 opened this issue Mar 26, 2024 · 2 comments

Comments

@xusheng6
Copy link
Member

xusheng6 commented Mar 26, 2024

Happens on 4.1.4997-dev (3e7dbdea). I updated macOS to 14.4.1 (23E224) today, which I hope is not relevant.

Update: it works fine on the stable release (4.0.4958 (ddff9339))

Update: the crash is introduced in 4.1.4972-dev

Weird enough, this only reproduces on a release build from the build server. It does not reproduce locally, despite also being a release build

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x1979faa60 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x197a32c20 pthread_kill + 288
2   libsystem_c.dylib             	       0x19793fa20 abort + 180
3   Python                        	       0x1222357a8 fatal_error_exit + 16
4   Python                        	       0x1222355fc fatal_error + 44
5   Python                        	       0x122237b30 _Py_FatalErrorFormat + 228
6   Python                        	       0x122237b4c _Py_FatalRefcountErrorFunc + 28
7   Python                        	       0x122161114 none_dealloc + 28
8   Python                        	       0x1221e6e90 _PyEval_EvalFrameDefault + 600
9   Python                        	       0x1221f5848 _PyEval_Vector + 116
10  Python                        	       0x122116260 method_vectorcall + 168
11  QtGui.abi3.so                 	       0x137a96198 QSyntaxHighlighterWrapper::highlightBlock(QString const&) + 200
12  QtGui                         	       0x107e8dce8 QSyntaxHighlighterPrivate::reformatBlock(QTextBlock const&) + 128
13  QtGui                         	       0x107e8dc00 QSyntaxHighlighterPrivate::reformatBlocks(int, int, int) + 360
14  QtCore                        	       0x1065f38f8 void doActivate<false>(QObject*, int, void**) + 1396
15  QtGui                         	       0x107ea3bf4 QTextDocument::contentsChange(int, int, int) + 76
16  QtGui                         	       0x107ea8940 QTextDocumentPrivate::finishEdit() + 124
17  QtWidgets                     	       0x10775acdc QWidgetTextControlPrivate::setContent(Qt::TextFormat, QString const&, QTextDocument*) + 1180
18  QtWidgets.abi3.so             	       0x1529600d4 Sbk_QPlainTextEditFunc_setPlainText(_object*, _object*) + 140
19  Python                        	       0x12215e3d0 cfunction_vectorcall_O + 92
20  Python                        	       0x1221f1070 _PyEval_EvalFrameDefault + 42040
21  Python                        	       0x1221f5848 _PyEval_Vector + 116
22  Python                        	       0x122116260 method_vectorcall + 168
23  libpyside6.abi3.6.6.dylib     	       0x123870860 PySide::SignalManager::callPythonMetaMethod(QMetaMethod const&, void**, _object*, bool) + 540
24  libpyside6.abi3.6.6.dylib     	       0x12387041c PySide::SignalManager::SignalManagerPrivate::qtMethodMetacall(QObject*, int, void**) + 760
25  QtCore                        	       0x1065f3664 void doActivate<false>(QObject*, int, void**) + 736
26  QtCore                        	       0x1067b9298 QItemSelectionModel::emitSelectionChanged(QItemSelection const&, QItemSelection const&) + 216
27  QtCore                        	       0x1067b8e80 QItemSelectionModel::select(QItemSelection const&, QFlags<QItemSelectionModel::SelectionFlag>) + 636
28  QtCore                        	       0x1067b8b60 QItemSelectionModel::select(QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) + 68
29  QtCore.abi3.so                	       0x127920e4c Sbk_QItemSelectionModelFunc_select(_object*, _object*) + 732
30  Python                        	       0x12215db40 cfunction_call + 100
31  Python                        	       0x122112e58 _PyObject_MakeTpCall + 128
32  Python                        	       0x1221f11c4 _PyEval_EvalFrameDefault + 42380
33  Python                        	       0x1221f5848 _PyEval_Vector + 116
34  Python                        	       0x122113174 _PyObject_FastCallDictTstate + 208
35  Python                        	       0x12217d030 slot_tp_init + 188
36  Python                        	       0x1221754dc type_call + 136
37  Python                        	       0x122112e58 _PyObject_MakeTpCall + 128
38  Python                        	       0x1221f11c4 _PyEval_EvalFrameDefault + 42380
39  Python                        	       0x1221f5848 _PyEval_Vector + 116
40  Python                        	       0x122114e34 object_vacall + 228
41  Python                        	       0x122115084 PyObject_CallFunctionObjArgs + 44
42  binaryninjaui.abi3.so         	       0x151939320 std::__1::__function::__func<Sbk_UIAction_Init(_object*, _object*, _object*)::$_0, std::__1::allocator<Sbk_UIAction_Init(_object*, _object*, _object*)::$_0>, void (UIActionContext const&)>::operator()(UIActionContext const&) + 76
43  libbinaryninjaui.1.dylib      	       0x106bd93e0 UIActionHandler::executeAction(QString const&, UIActionContext const&) + 296
44  libbinaryninjaui.1.dylib      	       0x106bd9390 UIActionHandler::executeAction(QString const&, UIActionContext const&) + 216
45  libbinaryninjaui.1.dylib      	       0x106bd9390 UIActionHandler::executeAction(QString const&, UIActionContext const&) + 216
46  libbinaryninjaui.1.dylib      	       0x106c4358c CommandPalette::itemClicked(QModelIndex const&) + 576
47  QtCore                        	       0x1065f3694 void doActivate<false>(QObject*, int, void**) + 784
48  QtWidgets                     	       0x1077d2818 QAbstractItemView::activated(QModelIndex const&) + 52
49  libbinaryninjaui.1.dylib      	       0x106c41e1c CommandList::keyPressEvent(QKeyEvent*) + 192
50  QtWidgets                     	       0x1075af82c QWidget::event(QEvent*) + 488
51  QtWidgets                     	       0x107632a98 QFrame::event(QEvent*) + 56
52  QtWidgets                     	       0x1077d0db4 QAbstractItemView::event(QEvent*) + 484
53  QtWidgets                     	       0x10756716c QApplicationPrivate::notify_helper(QObject*, QEvent*) + 272
54  QtWidgets                     	       0x1075681c0 QApplication::notify(QObject*, QEvent*) + 1036
55  QtCore                        	       0x1065a9774 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 292
56  QtWidgets                     	       0x1075c3248 QWidgetWindow::event(QEvent*) + 180
57  QtWidgets                     	       0x10756716c QApplicationPrivate::notify_helper(QObject*, QEvent*) + 272
58  QtWidgets                     	       0x107567fac QApplication::notify(QObject*, QEvent*) + 504
59  QtCore                        	       0x1065a9774 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 292
60  QtGui                         	       0x107c83bd8 QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) + 252
61  QtGui                         	       0x107cdf1a4 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 408
62  QtGui                         	       0x107cded90 QWindowSystemInterface::flushWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 524
63  libqcocoa.dylib               	       0x10568dcbc -[QNSView(Keys) handleKeyEvent:] + 1832
64  libqcocoa.dylib               	       0x10568ebb4 -[QNSView(Keys) keyDown:] + 92
65  AppKit                        	       0x19b493fec -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 480
66  AppKit                        	       0x19b493c38 -[NSWindow(NSEventRouting) sendEvent:] + 284
67  libqcocoa.dylib               	       0x105696f84 -[QNSWindow sendEvent:] + 860
68  AppKit                        	       0x19bb59e70 -[NSApplication(NSEventRouting) sendEvent:] + 1604
69  libqcocoa.dylib               	       0x105637510 -[QNSApplication sendEvent:] + 76
70  AppKit                        	       0x19b7a78cc -[NSApplication _handleEvent:] + 60
71  AppKit                        	       0x19b35bcdc -[NSApplication run] + 512
72  libqcocoa.dylib               	       0x1056435b8 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2124
73  QtCore                        	       0x1065b3458 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 540
74  QtCore                        	       0x1065a9e00 QCoreApplication::exec() + 112
75  binaryninja                   	       0x104094a88 0x104034000 + 395912
76  dyld                          	       0x1976aa0e0 start + 2360
@xusheng6
Copy link
Member Author

xusheng6 commented May 1, 2024

As can be seen from the stack trace, the crash is somehow related to syntax highlighting. Setting snippets.syntaxHighlight to false avoids the crash, which can be used as a workaround for now

@xusheng6
Copy link
Member Author

xusheng6 commented May 1, 2024

I am unable to determine the root cause of the crash, and I start to suspect that Qt is at least partially responsible for the crash. What I know is -- not surprisingly -- if I comment out this line, the crash is gone: https://github.com/Vector35/snippets/blob/master/QCodeEditor.py#L64. And I tested it is the large amount of calls setFormat that causes the trouble. Even if I change the code to always highlight a same char with a bare QColor, the crash still happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant