Skip to content

Commit b950e1d

Browse files
fix: Revert fix: Fix crashes when calling sourcesAtFrame when clearing (#1185)
### Revert fix: Fix crashes when calling sourcesAtFrame when clearing ### Linked issues NA ### Summarize your change. Reverted this commit to fix regression: 02a537b ### Describe the reason for the change. The commit that is being reverted in this commit caused a regression. The following errors when clearing an RV session: ``` ERROR: event = before-graph-view-change ERROR: function = __lambdac96 (void; Event event) ERROR: Exception Value: exception: "nil argument to function" ERROR: event = after-graph-view-change ERROR: function = __lambdadd8 (void; Event event) ERROR: Exception Value: exception: "nil argument to function" ERROR: event = graph-node-inputs-changed ERROR: function = __lambdadd9 (void; Event event) ERROR: Exception Value: exception: "nil argument to function" Traceback (most recent call last): File "/private/var/folders/10/sd1gk1s527bfkdmmlbg7352c0000gn/T/AppTranslocation/919C640B-34AC-4B5F-A9AE-D30F60636CDB/d/RV.app/Contents/PlugIns/Python/source_setup.py", line 505, in checkForDisplayGroup if commands.nodeType(event.contents()) == "RVDisplayGroup": ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Exception: Exception thrown while calling commands.nodeType -- exception: "nil argument to function" Traceback (most recent call last): File "/private/var/folders/10/sd1gk1s527bfkdmmlbg7352c0000gn/T/AppTranslocation/919C640B-34AC-4B5F-A9AE-D30F60636CDB/d/RV.app/Contents/PlugIns/Python/source_setup.py", line 505, in checkForDisplayGroup if commands.nodeType(event.contents()) == "RVDisplayGroup": ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Exception: Exception thrown while calling commands.nodeType -- exception: "nil argument to function" ``` ### Describe what you have tested and on which operating system. Successfully tested on macOS ### Add a list of changes, and note any that might need special attention during the review. ### If possible, provide screenshots. Signed-off-by: Bernard Laberge <bernard.laberge@autodesk.com>
1 parent ef2181f commit b950e1d

File tree

3 files changed

+4
-122
lines changed

3 files changed

+4
-122
lines changed

src/lib/ip/IPCore/IPCore/Session.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,8 +1090,6 @@ namespace IPCore
10901090

10911091
bool beingDeleted() { return m_beingDeleted; }
10921092

1093-
bool beingCleared() { return m_beingCleared; }
1094-
10951093
void physicalDeviceChanged(const VideoDevice*);
10961094

10971095
protected:
@@ -1258,7 +1256,6 @@ namespace IPCore
12581256
bool m_audioUnavailble;
12591257
static float m_audioDrift;
12601258
bool m_beingDeleted;
1261-
bool m_beingCleared{false};
12621259
CacheStats m_cacheStats;
12631260
Time m_syncOffset;
12641261
SyncTimes m_syncTimes;

src/lib/ip/IPCore/Session.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#include <boost/uuid/uuid.hpp>
5353
#include <boost/uuid/uuid_generators.hpp>
5454
#include <boost/uuid/uuid_io.hpp>
55-
#include <boost/scope_exit.hpp>
5655
#include <iterator>
5756

5857
#ifndef PLATFORM_WINDOWS
@@ -1696,9 +1695,6 @@ namespace IPCore
16961695

16971696
void Session::clear()
16981697
{
1699-
m_beingCleared = true;
1700-
BOOST_SCOPE_EXIT_ALL(&) { m_beingCleared = false; };
1701-
17021698
if (!m_beingDeleted)
17031699
{
17041700
userGenericEvent("before-clear-session", "");

src/lib/ip/IPMu/CommandsModule.cpp

Lines changed: 4 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
#include <half.h>
7676
#include <iostream>
7777
#include <iterator>
78-
#include <optional>
7978
#include <sstream>
8079
#include <stl_ext/string_algo.h>
8180
#include <unordered_set>
@@ -95,27 +94,6 @@ namespace IPMu
9594
typedef Session::PropertyVector PropertyVector;
9695
typedef TwkApp::EventType::EventInstance Event;
9796

98-
//----------------------------------------------------------------------
99-
//
100-
// Helper function to check if node graph access is safe during
101-
// session clearing/deletion. Returns the provided default value
102-
// if access is unsafe, otherwise returns std::nullopt.
103-
//
104-
// Usage:
105-
// if (auto val = returnIfGraphUnsafe(s, Pointer(0))) {
106-
// NODE_RETURN(*val);
107-
// }
108-
// // Continue with normal graph access...
109-
//
110-
template <typename T> std::optional<T> returnIfGraphUnsafe(Session* session, T defaultValue)
111-
{
112-
if (session->beingCleared() || session->beingDeleted())
113-
{
114-
return defaultValue;
115-
}
116-
return std::nullopt;
117-
}
118-
11997
//----------------------------------------------------------------------
12098

12199
static void throwBadArgumentException(const Mu::Node& node, Mu::Thread& thread, const Mu::String& msg)
@@ -581,12 +559,6 @@ namespace IPMu
581559
StringType::String* leaf = NODE_ARG_OBJECT(2, StringType::String);
582560
const bool unique = NODE_ARG(3, bool);
583561

584-
if (auto val = returnIfGraphUnsafe(s, array))
585-
{
586-
(*val)->resize(0);
587-
NODE_RETURN(*val);
588-
}
589-
590562
IPNode::MetaEvalInfoVector infos;
591563
IPNode* rootNode = s->graph().viewNode();
592564

@@ -682,12 +654,6 @@ namespace IPMu
682654
StringType::String* root = NODE_ARG_OBJECT(2, StringType::String);
683655
const bool unique = NODE_ARG(3, bool);
684656

685-
if (auto val = returnIfGraphUnsafe(s, array))
686-
{
687-
(*val)->resize(0);
688-
NODE_RETURN(*val);
689-
}
690-
691657
IPNode* rootNode = s->graph().root();
692658

693659
if (root)
@@ -762,13 +728,6 @@ namespace IPMu
762728
int depth = NODE_ARG(1, int);
763729
StringType::String* root = NODE_ARG_OBJECT(2, StringType::String);
764730
const Class* atype = static_cast<const Class*>(c->arrayType(c->intType(), 1, 0));
765-
DynamicArray* array = new DynamicArray(atype, 1);
766-
767-
if (auto val = returnIfGraphUnsafe(s, array))
768-
{
769-
(*val)->resize(0);
770-
NODE_RETURN(*val);
771-
}
772731

773732
IPNode* rootNode = s->graph().root();
774733

@@ -809,6 +768,8 @@ namespace IPMu
809768
for (size_t i = 0; i < frames.size(); i++)
810769
frameSet.insert(frames[i]);
811770

771+
DynamicArray* array = new DynamicArray(atype, 1);
772+
812773
array->resize(frameSet.size());
813774
size_t count = 0;
814775

@@ -832,12 +793,6 @@ namespace IPMu
832793
int depth = NODE_ARG(2, int);
833794
const StringType* stype = c->stringType();
834795

835-
if (auto val = returnIfGraphUnsafe(s, array))
836-
{
837-
(*val)->resize(0);
838-
NODE_RETURN(*val);
839-
}
840-
841796
IPNode* rootNode = s->graph().root();
842797

843798
if (root)
@@ -1269,16 +1224,9 @@ namespace IPMu
12691224
if (!tname)
12701225
throwBadArgumentException(NODE_THIS, NODE_THREAD, "nil tname");
12711226

1272-
DynamicArray* array = new DynamicArray(atype, 1);
1273-
1274-
if (auto val = returnIfGraphUnsafe(s, array))
1275-
{
1276-
(*val)->resize(0);
1277-
NODE_RETURN(*val);
1278-
}
1279-
12801227
Session::NodeVector nodes;
12811228
s->findCurrentNodesByTypeName(nodes, tname->c_str());
1229+
DynamicArray* array = new DynamicArray(atype, 1);
12821230
array->resize(nodes.size());
12831231

12841232
for (int i = 0; i < nodes.size(); i++)
@@ -1301,16 +1249,9 @@ namespace IPMu
13011249
if (!tname)
13021250
throwBadArgumentException(NODE_THIS, NODE_THREAD, "nil tname");
13031251

1304-
DynamicArray* array = new DynamicArray(atype, 1);
1305-
1306-
if (auto val = returnIfGraphUnsafe(s, array))
1307-
{
1308-
(*val)->resize(0);
1309-
NODE_RETURN(*val);
1310-
}
1311-
13121252
Session::NodeVector nodes;
13131253
s->findNodesByTypeName(nodes, tname->c_str());
1254+
DynamicArray* array = new DynamicArray(atype, 1);
13141255
array->resize(nodes.size());
13151256

13161257
for (int i = 0; i < nodes.size(); i++)
@@ -2000,12 +1941,6 @@ namespace IPMu
20001941
const int frame = NODE_ARG(0, int);
20011942
DynamicArray* array = new DynamicArray(atype, 1);
20021943

2003-
if (auto val = returnIfGraphUnsafe(s, array))
2004-
{
2005-
(*val)->resize(0);
2006-
NODE_RETURN(*val);
2007-
}
2008-
20091944
IPNode::MetaEvalInfoVector infos;
20101945
IPNode::MetaEvalInfoCollectorByType<SourceIPNode> collector(infos);
20111946
s->graph().root()->metaEvaluate(s->graph().contextForFrame(frame), collector);
@@ -3864,12 +3799,6 @@ namespace IPMu
38643799
DynamicArray* array = new DynamicArray(type, 1);
38653800
const StringType* stype = c->stringType();
38663801

3867-
if (auto val = returnIfGraphUnsafe(s, array))
3868-
{
3869-
(*val)->resize(0);
3870-
NODE_RETURN(*val);
3871-
}
3872-
38733802
const IPGraph::NodeMap& map = s->graph().nodeMap();
38743803

38753804
array->resize(map.size());
@@ -3895,11 +3824,6 @@ namespace IPMu
38953824
if (!node)
38963825
throwBadArgumentException(NODE_THIS, NODE_THREAD, "nil node name");
38973826

3898-
if (auto val = returnIfGraphUnsafe(s, Pointer(0)))
3899-
{
3900-
NODE_RETURN(*val);
3901-
}
3902-
39033827
if (IPNode* n = s->graph().findNode(node->c_str()))
39043828
{
39053829
type = stype->allocate(n->protocol());
@@ -4127,11 +4051,6 @@ namespace IPMu
41274051
throwBadArgumentException(NODE_THIS, NODE_THREAD, "no node name specified");
41284052
}
41294053

4130-
if (auto val = returnIfGraphUnsafe(s, Pointer(0)))
4131-
{
4132-
NODE_RETURN(*val);
4133-
}
4134-
41354054
if (IPNode* node = s->graph().findNode(name->c_str()))
41364055
{
41374056
IPNode::IPNodes nodeIns = node->inputs();
@@ -4233,11 +4152,6 @@ namespace IPMu
42334152
throwBadArgumentException(NODE_THIS, NODE_THREAD, "no node name specified");
42344153
}
42354154

4236-
if (auto val = returnIfGraphUnsafe(s, Pointer(0)))
4237-
{
4238-
NODE_RETURN(*val);
4239-
}
4240-
42414155
if (IPNode* node = s->graph().findNode(name->c_str()))
42424156
{
42434157
if (GroupIPNode* group = dynamic_cast<GroupIPNode*>(node))
@@ -4295,11 +4209,6 @@ namespace IPMu
42954209
throwBadArgumentException(NODE_THIS, NODE_THREAD, "no node name specified");
42964210
}
42974211

4298-
if (auto val = returnIfGraphUnsafe(s, Pointer(0)))
4299-
{
4300-
NODE_RETURN(*val);
4301-
}
4302-
43034212
if (IPNode* node = s->graph().findNode(name->c_str()))
43044213
{
43054214
if (GroupIPNode* group = node->group())
@@ -4324,11 +4233,6 @@ namespace IPMu
43244233
throwBadArgumentException(NODE_THIS, NODE_THREAD, "no node name specified");
43254234
}
43264235

4327-
if (auto val = returnIfGraphUnsafe(s, Pointer(0)))
4328-
{
4329-
NODE_RETURN(*val);
4330-
}
4331-
43324236
if (IPNode* node = s->graph().findNode(name->c_str()))
43334237
{
43344238
if (GroupIPNode* group = dynamic_cast<GroupIPNode*>(node))
@@ -4367,11 +4271,6 @@ namespace IPMu
43674271
if (!name)
43684272
throwBadArgumentException(NODE_THIS, NODE_THREAD, "nil node name");
43694273

4370-
if (auto val = returnIfGraphUnsafe(s, Pointer(0)))
4371-
{
4372-
NODE_RETURN(*val);
4373-
}
4374-
43754274
if (IPNode* node = s->graph().findNode(name->c_str()))
43764275
{
43774276
struct InfoStruct
@@ -4417,11 +4316,6 @@ namespace IPMu
44174316
if (!name)
44184317
throwBadArgumentException(NODE_THIS, NODE_THREAD, "nil node name");
44194318

4420-
if (auto val = returnIfGraphUnsafe(s, Pointer(0)))
4421-
{
4422-
NODE_RETURN(*val);
4423-
}
4424-
44254319
if (IPNode* node = s->graph().findNode(name->c_str()))
44264320
{
44274321
struct InfoStruct
@@ -5067,11 +4961,6 @@ namespace IPMu
50674961
throwBadArgumentException(NODE_THIS, NODE_THREAD, "nil source");
50684962
const StringType* stype = static_cast<const StringType*>(name->type());
50694963

5070-
if (auto val = returnIfGraphUnsafe(s, Pointer(0)))
5071-
{
5072-
NODE_RETURN(*val);
5073-
}
5074-
50754964
// for campatibility with rv, scrub the incoming name
50764965
vector<string> tokens;
50774966
stl_ext::tokenize(tokens, name->c_str(), "./");

0 commit comments

Comments
 (0)