From dbbd3351efa7d84bb613621b94c600ee9e65f4be Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 16 May 2014 10:10:50 -0700 Subject: [PATCH] Fix node bounds overlay blinking QString.to* do not seem to return null terminated strings. --- interface/src/ui/NodeBounds.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/interface/src/ui/NodeBounds.cpp b/interface/src/ui/NodeBounds.cpp index 4621be6c42..e1e37fe21b 100644 --- a/interface/src/ui/NodeBounds.cpp +++ b/interface/src/ui/NodeBounds.cpp @@ -216,18 +216,22 @@ void NodeBounds::drawOverlay() { const float TEXT_COLOR[] = { 0.90f, 0.90f, 0.90f }; const float TEXT_SCALE = 0.1f; const int TEXT_HEIGHT = 10; + const float ROTATION = 0.0f; + const int FONT = 2; const int PADDING = 10; const int MOUSE_OFFSET = 10; const int BACKGROUND_OFFSET_Y = -20; const int BACKGROUND_BEVEL = 3; - char* text = _overlayText.toLatin1().data(); + char textData[_overlayText.length() + 1]; + strcpy(textData, _overlayText.toLatin1().constData()); + int mouseX = application->getMouseX(), mouseY = application->getMouseY(), - textWidth = widthText(TEXT_SCALE, 0, text); + textWidth = widthText(TEXT_SCALE, 0, textData); glColor4f(0.4, 0.4, 0.4, 0.6); renderBevelCornersRect(mouseX + MOUSE_OFFSET, mouseY - TEXT_HEIGHT - PADDING, textWidth + (2 * PADDING), TEXT_HEIGHT + (2 * PADDING), BACKGROUND_BEVEL); - drawText(mouseX + MOUSE_OFFSET + PADDING, mouseY, TEXT_SCALE, 0.0f, 0, text, TEXT_COLOR); + drawText(mouseX + MOUSE_OFFSET + PADDING, mouseY, TEXT_SCALE, ROTATION, FONT, textData, TEXT_COLOR); } }