After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 617472 - doubled items in locals view
doubled items in locals view
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: symbol-db
git master
Other Linux
: Normal normal
: ---
Assigned To: Naba Kumar
Anjuta maintainers
: 620880 (view as bug list)
Depends on: 615403
Blocks:
 
 
Reported: 2010-05-02 21:05 UTC by Massimo Cora'
Modified: 2010-07-01 20:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
items locals view (26.12 KB, image/png)
2010-05-02 21:05 UTC, Massimo Cora'
Details

Description Massimo Cora' 2010-05-02 21:05:40 UTC
Created attachment 160171 [details]
items locals view

while editing plugins/symbol-db/anjuta-tags/c.c file
I saw doubled items as in the screenshot.
clicking on them brings me at the right locations of symbols but on differnt files.

This should of course be avoided and only the real local symbol should be visualized.
Comment 1 Naba Kumar 2010-05-05 10:12:20 UTC
The view tries to show parents of any symbol found in the file. For example, classes or structs can have their members defined in the file, yet have their class definitions found in different file.

When trying to find the parent of the enum members found in that file, it get's following parents:

sqlite> select name, scope_definition_id from symbol where scope_definition_id = 7038;
eTokenType|7038
eTokenType|7038
eTokenType|7038
eTokenType|7038
eTokenType|7038
eTokenType|7038
eTokenType|7038
sqlite> 

That's basically manifestation of bug 615403

Just like we had to work it around for namespaces, I thought about hacking SQL again for enums, but I think it's pointless. We should fix bug 615403 instead properly.
Comment 2 Massimo Cora' 2010-05-08 19:21:54 UTC
(In reply to comment #1)
> The view tries to show parents of any symbol found in the file. For example,
> classes or structs can have their members defined in the file, yet have their
> class definitions found in different file.
> 
> When trying to find the parent of the enum members found in that file, it get's
> following parents:
> 
> sqlite> select name, scope_definition_id from symbol where scope_definition_id
> = 7038;
> eTokenType|7038
> eTokenType|7038
> eTokenType|7038
> eTokenType|7038
> eTokenType|7038
> eTokenType|7038
> eTokenType|7038
> sqlite> 
> 
> That's basically manifestation of bug 615403
> 

well, I think your query is wrong.
You should check *in* that file only for eTokenType.

sqlite> select * from symbol join file on symbol.file_defined_id = file.file_id where file_id = 381 and name = 'eTokenType';

30081|381|eTokenType|108|1|||20816|0|7745|13|-1|-1|1|381|/plugins/symbol-db/anjuta-tags/c.c|1|1|2010-05-03 21:08:45
Comment 3 Naba Kumar 2010-05-09 12:32:49 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > The view tries to show parents of any symbol found in the file. For example,
> > classes or structs can have their members defined in the file, yet have their
> > class definitions found in different file.
> > 
> 
> well, I think your query is wrong.
> You should check *in* that file only for eTokenType.
> 
If you read my first para in comment #1, you will understand why I think that's not correct.

First, the local view is not necessarily showing only the content of the file. It shows content of the file and their parents. The parent's don't necessarily have to be in the same file, as demonstrated by namespaces, classes and structs (yes, in C++ structs can have member methods too, although no one really uses it that way). So, the natural query is: "Select all symbols that are in this file, plus the parents of these local symbols, ...". This bug creates an exception to this rule, and exceptions should be avoided in favor of more well defined structures.
Comment 4 Naba Kumar 2010-05-09 12:35:23 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > The view tries to show parents of any symbol found in the file. For example,
> > > classes or structs can have their members defined in the file, yet have their
> > > class definitions found in different file.
> > > 
> > 
> > well, I think your query is wrong.
> > You should check *in* that file only for eTokenType.
> > 
> If you read my first para in comment #1, you will understand why I think that's
> not correct.
> 
> First, the local view is not necessarily showing only the content of the file.
> It shows content of the file and their parents. The parent's don't necessarily
> have to be in the same file, as demonstrated by namespaces, classes and structs
> (yes, in C++ structs can have member methods too, although no one really uses
> it that way). So, the natural query is: "Select all symbols that are in this
> file, plus the parents of these local symbols, ...". This bug creates an
> exception to this rule, and exceptions should be avoided in favor of more well
> defined structures.

I forgot to mention the 2nd reason. Secondly, bug 615403 fixes this, along with many other manifestations. So, in the end, the real deal is to take care of bug 615403.
Comment 5 Naba Kumar 2010-07-01 20:23:03 UTC
*** Bug 620880 has been marked as a duplicate of this bug. ***
Comment 6 Naba Kumar 2010-07-01 20:33:37 UTC
Since this bug affects more use cases, like in vala, I fixed the workaround instead of waiting for bug 615403 to resolve.

Now, only parents of type 'class' are picked up from outside the file. This means if you use struct as c++ class spanning multiple files, that one isn't going to work, for example. And possibly other corner cases that I don't know yet. Anyways, I suppose that's less of a bug than the vala case.

Fixed with commit http://git.gnome.org/browse/anjuta/commit/?id=9ce91d66718fa3282863aaac805d1b8b91d68429