mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:52:45 +00:00 
			
		
		
		
	Inspector: Fix bad RemoteObjectGraphModel::parent_index()
We were returning bogus indices and also failing to handle parents that are roots. This was visible in the broken line trees drawn by GTreeView.
This commit is contained in:
		
							parent
							
								
									797e132d0c
								
							
						
					
					
						commit
						d5f1c57fe2
					
				
					 1 changed files with 13 additions and 2 deletions
				
			
		|  | @ -36,8 +36,19 @@ GModelIndex RemoteObjectGraphModel::parent_index(const GModelIndex& index) const | |||
|     auto& remote_object = *static_cast<RemoteObject*>(index.internal_data()); | ||||
|     if (!remote_object.parent) | ||||
|         return {}; | ||||
|     for (int row = 0; row < remote_object.parent->children.size(); ++row) { | ||||
|         if (&remote_object.parent->children[row] == &remote_object) | ||||
| 
 | ||||
|     // NOTE: If the parent has no parent, it's a root, so we have to look among the remote roots.
 | ||||
|     if (!remote_object.parent->parent) { | ||||
|         for (int row = 0; row < m_process.roots().size(); ++row) { | ||||
|             if (&m_process.roots()[row] == remote_object.parent) | ||||
|                 return create_index(row, 0, remote_object.parent); | ||||
|         } | ||||
|         ASSERT_NOT_REACHED(); | ||||
|         return {}; | ||||
|     } | ||||
| 
 | ||||
|     for (int row = 0; row < remote_object.parent->parent->children.size(); ++row) { | ||||
|         if (&remote_object.parent->parent->children[row] == remote_object.parent) | ||||
|             return create_index(row, 0, remote_object.parent); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling