Re: Best way to inspect the parse tree from Sparse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 9, 2017 at 2:47 PM, Dibyendu Majumdar
<mobile@xxxxxxxxxxxxxxx> wrote:
>
> Thread 1 "test-inspect" received signal SIGSEGV, Segmentation fault.
> ast_iter_n_children (tree_model=0x725400, iter=0x0) at ast-model.c:404

Err, iter == NULL.

The function comment said it all. if iter == NULL, should return the
root node's children number.

Can you try the following one line change?
I can only verify it compiles. But I have no way to test it.

I also totally forget how this tree view model works now.
Let's hope that fix it.

Thanks

Chris

diff --git a/ast-model.c b/ast-model.c
index 704c487..cbfdc1f 100644
--- a/ast-model.c
+++ b/ast-model.c
@@ -401,7 +401,7 @@ static gint
 ast_iter_n_children (GtkTreeModel *tree_model,
                           GtkTreeIter  *iter)
 {
-       AstNode  *node = iter->user_data;
+       AstNode  *node = iter ? iter->user_data : AST_NODE(tree_model);

        inspect_child_node(node);
        return node->childnodes->len;
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux