File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,19 @@ GModelIndex RemoteObjectGraphModel::parent_index(const GModelIndex& index) const
36
36
auto & remote_object = *static_cast <RemoteObject*>(index.internal_data ());
37
37
if (!remote_object.parent )
38
38
return {};
39
- for (int row = 0 ; row < remote_object.parent ->children .size (); ++row) {
40
- if (&remote_object.parent ->children [row] == &remote_object)
39
+
40
+ // NOTE: If the parent has no parent, it's a root, so we have to look among the remote roots.
41
+ if (!remote_object.parent ->parent ) {
42
+ for (int row = 0 ; row < m_process.roots ().size (); ++row) {
43
+ if (&m_process.roots ()[row] == remote_object.parent )
44
+ return create_index (row, 0 , remote_object.parent );
45
+ }
46
+ ASSERT_NOT_REACHED ();
47
+ return {};
48
+ }
49
+
50
+ for (int row = 0 ; row < remote_object.parent ->parent ->children .size (); ++row) {
51
+ if (&remote_object.parent ->parent ->children [row] == remote_object.parent )
41
52
return create_index (row, 0 , remote_object.parent );
42
53
}
43
54
You can’t perform that action at this time.
0 commit comments