QtQuickVcp
QtQuickVcp copied to clipboard
Cetus PathView crash under macOS
Hello
The PathView control is crashing the macOS Machinekit Client when activated in Cetus. Either with the latest MachinekitClient binary or by building it manually. Same issue under macOS 10.13 (High Sierra) or 10.12 (Sierra).
The issue seems to come from drawTexts() in glview.cpp.
I don't know how to fix it, but I can test any patch, I have Machinekit building in QtCreator (Qt5.12.1 64bit). No crash occurs after removing the calls to drawTexts().
Let me know if you need any more details :) Thank you, Benjamin
Here is part of the crashlog:
OS Version: Mac OS X 10.13.6 (17G65)
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000090
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
VM Regions Near 0x90:
-->
__TEXT 0000000101b40000-0000000101b77000 [ 220K] r-x/rwx SM=COW I [apps/MachinekitClient/machinekit-client.app/Contents/MacOS/machinekit-client]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.driver.AppleIntelKBLGraphicsGLDriver 0x000000010a01285c IntelTextureObj::getSurfaceHeapOffset(unsigned int, IntelStateHeaps*, unsigned int&, bool&) + 4
1 com.apple.driver.AppleIntelKBLGraphicsGLDriver 0x000000010a012390 void updateBindingTable<SGfx3dStateBindingTablePointers>(GenContext*, unsigned int, SGfx3dStateBindingTablePointers&) + 2165
2 com.apple.driver.AppleIntelKBLGraphicsGLDriver 0x000000010a00f26e GenContext::ProgramPipeline() + 18032
3 com.apple.driver.AppleIntelKBLGraphicsGLDriver 0x000000010a00a232 glrIntelRenderVertexArray + 412
4 GLEngine 0x00007fff452895b3 glDrawArrays_ACC_Exec + 387
5 libmachinekitpathviewplugin_debug.dylib 0x000000010d2bdd38 QOpenGLFunctions::glDrawArrays(unsigned int, int, int) + 104 (qopenglfunctions.h:770)
6 libmachinekitpathviewplugin_debug.dylib 0x000000010d2b9b17 qtquickvcp::GLView::drawTexts() + 1239 (glview.cpp:891)
7 libmachinekitpathviewplugin_debug.dylib 0x000000010d2c14a4 qtquickvcp::GLView::paint() + 692 (glview.cpp:1594)
8 libmachinekitpathviewplugin_debug.dylib 0x000000010d2c11dd qtquickvcp::GLView::paint(QPainter*) + 45 (glview.cpp:1174)
9 org.qt-project.QtQuick 0x0000000101c43de8 QSGDefaultPainterNode::paint() + 872
10 org.qt-project.QtQuick 0x0000000101c43ed2 QSGDefaultPainterNode::update() + 50
11 org.qt-project.QtQuick 0x0000000101ceb041 QQuickPaintedItem::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) + 1265
12 org.qt-project.QtQuick 0x0000000101cadd5c QQuickWindowPrivate::updateDirtyNode(QQuickItem*) + 2908
13 org.qt-project.QtQuick 0x0000000101c9d589 QQuickWindowPrivate::updateDirtyNodes() + 1017
14 org.qt-project.QtQuick 0x0000000101c9cf7f QQuickWindowPrivate::syncSceneGraph() + 271
15 org.qt-project.QtQuick 0x0000000101c323f9 QSGGuiThreadRenderLoop::renderWindow(QQuickWindow*) + 1113
16 org.qt-project.QtQuick 0x0000000101ca4b86 QQuickWindow::event(QEvent*) + 678
17 org.qt-project.QtWidgets 0x00000001030542cd QApplicationPrivate::notify_helper(QObject*, QEvent*) + 269
18 org.qt-project.QtWidgets 0x00000001030556d2 QApplication::notify(QObject*, QEvent*) + 594
19 org.qt-project.QtCore 0x00000001026f1a04 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 212
20 org.qt-project.QtGui 0x0000000102b268d5 QPlatformWindow::deliverUpdateRequest() + 69
21 libqcocoa.dylib 0x0000000105a63b86 QCocoaWindow::deliverUpdateRequest() + 182
22 libqcocoa.dylib 0x0000000105a55e2d QCocoaScreen::deliverUpdateRequests() + 909
23 libdispatch.dylib 0x00007fff62ad4db8 _dispatch_client_callout + 8
24 libdispatch.dylib 0x00007fff62ae7e81 _dispatch_continuation_pop + 472
25 libdispatch.dylib 0x00007fff62ad7081 _dispatch_source_invoke + 620
26 libdispatch.dylib 0x00007fff62ae0221 _dispatch_main_queue_callback_4CF + 776
27 com.apple.CoreFoundation 0x00007fff3acf5c19 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
28 com.apple.CoreFoundation 0x00007fff3acb7dfa __CFRunLoopRun + 2586
29 com.apple.CoreFoundation 0x00007fff3acb7153 CFRunLoopRunSpecific + 483
30 com.apple.HIToolbox 0x00007fff39fa1d96 RunCurrentEventLoopInMode + 286
31 com.apple.HIToolbox 0x00007fff39fa1b06 ReceiveNextEventCommon + 613
32 com.apple.HIToolbox 0x00007fff39fa1884 _BlockUntilNextEventMatchingListInModeWithFilter + 64
33 com.apple.AppKit 0x00007fff38252a73 _DPSNextEvent + 2085
34 com.apple.AppKit 0x00007fff389e8e34 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
35 com.apple.AppKit 0x00007fff38247885 -[NSApplication run] + 764
36 libqcocoa.dylib 0x0000000105a76e2b QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2955
37 org.qt-project.QtCore 0x00000001026ed06f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
38 org.qt-project.QtCore 0x00000001026f2012 QCoreApplication::exec() + 130
39 io.machinekit.appdiscover 0x0000000101b444b5 main + 1813 (main.cpp:80)
40 libdyld.dylib 0x00007fff62b0e015 start + 1
Not certain it's done the right way (maybe a glActiveTexture(GL_TEXTURE0); should be done before leaving?), but I got it solved! Needs testing on other platforms though.
---
src/pathview/glview.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/pathview/glview.cpp b/src/pathview/glview.cpp
index dd98e58..5c45788 100644
--- a/src/pathview/glview.cpp
+++ b/src/pathview/glview.cpp
@@ -883,7 +883,7 @@ void GLView::drawTexts()
m_textProgram->setUniformValue(m_textAlignmentLocation, static_cast<GLint>(textParameters->alignment));
m_textProgram->setUniformValue(m_textColorLocation, textParameters->color);
m_textProgram->setUniformValue(m_textModelMatrixLocation, textParameters->modelMatrix);
- m_textProgram->setUniformValue(m_textTextureLocation, texture->textureId());
+ m_textProgram->setUniformValue(m_textTextureLocation, 1);
if (m_selectionModeActive) // selection mode active
{
@@ -892,9 +892,10 @@ void GLView::drawTexts()
m_currentDrawableId++;
}
- texture->bind(texture->textureId());
+ glActiveTexture(GL_TEXTURE1);
+ texture->bind();
glDrawArrays(GL_TRIANGLES, 0, vertexBuffer->size() / static_cast<int>(sizeof(TextVertex)));
- texture->release(texture->textureId());
+ texture->release();
}
m_textProgram->disableAttributeArray(m_textPositionLocation);
--