News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Project wizard crashes CB

Started by KodamaDeveloped, May 21, 2020, 05:18:32 AM

Previous topic - Next topic

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).
(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!]

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
project.RemoveBuildTarget(Wizard.GetDebugName()); instead.

KodamaDeveloped

#4
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.

huycan

Maybe you should try to put the project.RemoveBuildTarget here:

// Debug build target
local target = project.GetBuildTarget(Wizard.GetDebugName());
if (!IsNull(target))
   //SetupTarget(target, true);
   project.RemoveBuildTarget(Wizard.GetDebugName());
}


I am just trying to help out, since my computer not crashing either way.

oBFusCATed

Quote from: huycan on May 22, 2020, 06:22:37 AM
I am just trying to help out, since my computer not crashing either way.
This is the beauty of memory corruptions :)
(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!]