Author Topic: bug report: C::B crash when I remove the target from a cbp  (Read 2452 times)

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: bug report: C::B crash when I remove the target from a cbp
« Reply #15 on: October 18, 2022, 09:50:35 am »
I can also confirm no crash.
I spotted that after I deleted the C::B SDK target as the clangd_client kept parsing the SDK files (after pressing the OK button and waiting a few seconds). I suspect the files were queued to be processed and the queue was not reset/updated/fixed due to the SDK target being deleted. I think this could be logged as a bug, but as it does not cause any issues that I could see the bug could wait until some time in the future to fix when time permits. Does this sound okay? (Raise a bug and fix it when time permits.)



Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2526
Re: bug report: C::B crash when I remove the target from a cbp
« Reply #16 on: October 18, 2022, 05:59:14 pm »
I can also confirm no crash.
I spotted that after I deleted the C::B SDK target as the clangd_client kept parsing the SDK files (after pressing the OK button and waiting a few seconds). I suspect the files were queued to be processed and the queue was not reset/updated/fixed due to the SDK target being deleted. I think this could be logged as a bug, but as it does not cause any issues that I could see the bug could wait until some time in the future to fix when time permits. Does this sound okay? (Raise a bug and fix it when time permits.)

I'll log this into the clangd_client ticket systems.

Thanks guys.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2526
Re: bug report: C::B crash when I remove the target from a cbp
« Reply #17 on: October 18, 2022, 06:01:55 pm »
I can also confirm no crash.
I spotted that after I deleted the C::B SDK target as the clangd_client kept parsing the SDK files (after pressing the OK button and waiting a few seconds). I suspect the files were queued to be processed and the queue was not reset/updated/fixed due to the SDK target being deleted. I think this could be logged as a bug, but as it does not cause any issues that I could see the bug could wait until some time in the future to fix when time permits. Does this sound okay? (Raise a bug and fix it when time permits.)

@ Andrew
What was the message you on which you had to click ok.
It might help me to find exactly where the problem lies.

Edit: Never mind, I think you meant the target delete confirmation.

This is a rough one. The background queue can validly contain files that do not belong to a project or target.
And, the target is deleted before the cbEVT_BUILDTARGET_REMOVED event is issued, thus wiping out any info for comparison of background queue to target files.
« Last Edit: October 18, 2022, 07:46:26 pm by Pecan »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2526
Re: bug report: C::B crash when I remove the target from a cbp
« Reply #18 on: October 18, 2022, 08:28:01 pm »
Re: Clangd_client keeps parsing after target deletion.

There already is code in the parsers waiting queue to check that the file about to be parsed belongs to a project.
Code
        ProjectFile* pf = m_Project->GetFileByFilename(list->GetString(i));
        if (!pf)
            break;

So those sdk target files must have other targets referencing them. Or, there's an error in CB.

Since both old CodeCompletion and Clangd_client work at the project level, I'm pretty sure the code is correct.
But I can test like:
Code
pseudo code:
If file belongs to a project, and ProjectFile-GetTargets() returns zero targets, Do Not parse this file.

But I think that this is useless effort. I betcha it'll return a target every time. Since most projects have at least a release and debug target, one of them will always report that it owns the file. Especially in that CB will not let you delete a target if it's a single target project.

But I'll test deleting the sdk target anyway.
« Last Edit: October 18, 2022, 08:39:11 pm by Pecan »