User forums > General (but related to Code::Blocks)
Project wizard crashes CB
KodamaDeveloped:
CB20.03, Win10/mingw64.
My project wizard script crashes CB after I upgraded to 20.03, when the script trys to add/remove a target to/from a project in SetupProject primitive function. That may not always happen, but usually happens just after CB starts with blank workspace. That can be reproduced with the following simplest case.
- Start CB with blank workspace showing "Start here" page.
- Open "Console application" project wizard script in editor by [File|New|Project] dialog.
- Add "project.RemoveBuildTarget(0);" in SetupProject function just before "return true;".
- Save the script.
- Create a new project with the script by [File|New|Project].
- CB crashes.
Is that specific on my machine? Thank you.
oBFusCATed:
Generally a care should be taken to use the API correctly. It is a scripting API, but it is not too well protected.
I'll see what the problem is and prevent crashes, but probably your script is doing something it shouldn't do. Like removing a target that don't exists (this is a guess).
KodamaDeveloped:
Thanks for your reply. I noticed the issue with my script at first, and it is reproduced in another than mine, which is "Console application" wizard script which is distributed with CB. The simplest case I mentioned is supposed to remove "Debug" target because the script has had "Debug" and "Release" targets. It works in some cases, crashes in the other cases (especially just after CB starts up).
huycan:
I did exactly the steps you mentioned above. And mine did not crash. I tested several times. No crash.
Anyway, from the documentation, the RemoveBuildTarget requires a string, not a numeric... So I suggest you should try
--- Code: ---project.RemoveBuildTarget(Wizard.GetDebugName());
--- End code ---
instead.
KodamaDeveloped:
Thanks for your try, so it looks the issue is probably specific on my machine, unfortunately (or fortunately?). About the cbProject member RemoveBuildTarget function, from the documentation I think it has two overload versions, one of which takes int index as a parameter and the other takes const wxString &targetName. I've experienced crashes with both versions.
Navigation
[0] Message Index
[#] Next page
Go to full version