Skip to content

Commit

Permalink
HYDRA-720 : Fix scene browser crash when adding same prim multiple ti…
Browse files Browse the repository at this point in the history
…mes (#28)
  • Loading branch information
debloip-adsk authored Dec 20, 2023
1 parent b9d69f7 commit bafe0d3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/adskHydraSceneBrowser/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ foreach(SOURCE IN ITEMS ${SOURCES})
# "QVariant(someVariable.str().data())" -> "QVariant(QLatin1StringView(someVariable.str().data()))"
string(REGEX REPLACE "QVariant\\(\(${IDENTIFIER_REGEX}\)\.str\\(\\)\.\(c_str|data\)\\(\\)\\)" "QVariant(QLatin1StringView(\\1.str().\\2()))" FILE_CONTENTS "${FILE_CONTENTS}")

# Some setExpanded() calls are wrapped inside a QTimer::singleShot() call in order to defer their execution.
# This was done by Pixar in order to work around a crash in what appears to be some of their proprietary code
# (a method named PhdRequest::ExtractOptionalValue). However, this workaround now causes a crash on our end.
# Since the original intent was to directly call setExpanded(), we replace the QTimer::singleShot() workaround
# with a direct call to setExpanded(). This string regex does the following replacement :
# QTimer::singleShot(0, [this]() {
# this->setExpanded(true); -> setExpanded(true);
# });
set(SET_EXPANDED_REGEX "QTimer::singleShot\\(0, \\[this\\]\\(\\) {[\r\n\t ]+this->setExpanded\\(true\\);[\r\n\t ]+}\\);")
set(SET_EXPANDED_REPLACEMENT "setExpanded\(true\);")
string(REGEX REPLACE "${SET_EXPANDED_REGEX}" "${SET_EXPANDED_REPLACEMENT}" FILE_CONTENTS "${FILE_CONTENTS}")

# Patch in '#include <QString>' to make sure we can use QLatin1StringView
prepend_include(FILE_CONTENTS "#include <QString>")

Expand Down

0 comments on commit bafe0d3

Please sign in to comment.