Author Topic: reparse project or reparse file does not woks any more  (Read 7401 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
reparse project or reparse file does not woks any more
« on: November 02, 2011, 03:18:57 pm »
I just found that in rev 6546(trunk, build my self), in the project tree, If I right mouse click, and select "reparse this project" or "reparse this file",  both of them does not work, any one can reproduce this bug? I have also tried the latest nightly build, and looks like the bug is still there.

Thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: reparse project or reparse file does not woks any more
« Reply #1 on: November 02, 2011, 03:22:42 pm »
It looks like:
Code
void NativeParser::ReparseSelectedProject()
{
    wxTreeCtrl* tree = Manager::Get()->GetProjectManager()->GetTree();
    if (!tree)
        return;

    wxTreeItemId treeItem =  tree->GetSelection();
    if (!treeItem.IsOk())
        return;

    const FileTreeData* data = static_cast<FileTreeData*>(tree->GetItemData(treeItem));
    if (!data)
        return;

    if (data->GetKind() == FileTreeData::ftdkProject)
    {
        cbProject* project = data->GetProject();
        if (project)
        {
            DeleteParser(project);
            CreateParser(project);
        }
    }
}

Then, we always return from this:
Code
    wxTreeItemId treeItem =  tree->GetSelection();
    if (!treeItem.IsOk())
        return;
Why?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: reparse project or reparse file does not woks any more
« Reply #2 on: November 02, 2011, 03:27:37 pm »
Because the selection is not valid...
Do you have selection in the tree control?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: reparse project or reparse file does not woks any more
« Reply #3 on: November 03, 2011, 01:17:52 am »
Because the selection is not valid...
Do you have selection in the tree control?
Yes, I have select the project(cbp), and do mouse right click. So, I'm sure it was selected.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.