Author Topic: Request for review: cbProject::operator=  (Read 10643 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Request for review: cbProject::operator=
« on: November 15, 2014, 10:38:17 pm »
Here is the patch: http://cmpt.benbmp.org/codeblocks/patches/cbproject.copy.patch

Why I need this operator - because I need to fix this bug:
1. open project options
2. goto build targets
3. remove a target
4. close the dialog with cancel
5. reopen the dialog

What the user expects is that the target is still there, but in fact it is not, because the dialog works with the original object and not with a copy.
This is not a serious problem when using a modal dialog, but it is when the project options have been moved in an editor.

So any comments about the code will be welcome.
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Request for review: cbProject::operator=
« Reply #1 on: November 18, 2014, 11:39:19 am »
Well first it does not compile. :-)

It errors at:
Code
        ProjectFile* pf = new ProjectFile(this, **it);
...in cbproject.cpp.

Maybe I am missing something? (BTW: I was very happy to see that the patch applied seamlessly. ;-))
« Last Edit: November 18, 2014, 11:43:19 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Request for review: cbProject::operator=
« Reply #2 on: November 18, 2014, 07:45:47 pm »
What is the error?
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re:
« Reply #3 on: November 19, 2014, 06:24:52 pm »
I can't try at the moment but if i recall correctly the constructor was missing.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Request for review: cbProject::operator=
« Reply #4 on: November 19, 2014, 08:50:00 pm »
If you look at the patch it is there.
(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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Request for review: cbProject::operator=
« Reply #5 on: November 19, 2014, 09:54:13 pm »
@MortenMacFly :
Do you use wx2.8 or wx3 ?
It compiles flawlessly on linux with wx2.8.

@oBFusCATed :
should this already fix the issue with cancelling the properties-dialog ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Request for review: cbProject::operator=
« Reply #6 on: November 19, 2014, 11:01:00 pm »
No this is a commit extracted from the middle of my dev branch.
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Request for review: cbProject::operator=
« Reply #7 on: November 20, 2014, 08:44:16 am »
If you look at the patch it is there.
Mmmh... maybe the patch did not apply completely. :-)

After adding the missing (3) lines its working.

Next time SVN diff patch, please...  :P
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Request for review: cbProject::operator=
« Reply #8 on: November 20, 2014, 10:08:59 am »
Next time SVN diff patch, please...  :P
Sorry but there is no way this could happen. If this is not working for you then I'll just post the link to the branch in git.
(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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Request for review: cbProject::operator=
« Reply #9 on: November 20, 2014, 10:28:17 am »
Next time SVN diff patch, please...  :P
Best solution would be to use a version of patch (either standalone or included in whatever svn-tool you use) that works correctly.
I applied the patch on commandline with the standard patch-utility which ships with Fedora 20 without any problems.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Request for review: cbProject::operator=
« Reply #10 on: November 20, 2014, 05:49:25 pm »
Best solution would be to use a version of patch (either standalone or included in whatever svn-tool you use) that works correctly.
I applied the patch on commandline with the standard patch-utility which ships with Fedora 20 without any problems.
That's the bottle neck. On Linux there is no issue, for me, too. On Windows you have tones on incompatible patch tools and there is none fully compatible. (I've at least 4 of them for different aspects).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Request for review: cbProject::operator=
« Reply #11 on: November 20, 2014, 05:50:50 pm »
Sorry but there is no way this could happen.
The way would be through a branch, but I don't want to start this topic again...

But what I wonder is if GIT repos could be sync'ed with a SVN branch?? That would be a nice way to have GIT repos referenced in SVN. I never tried though.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Request for review: cbProject::operator=
« Reply #12 on: November 20, 2014, 07:16:41 pm »
But what I wonder is if GIT repos could be sync'ed with a SVN branch?? That would be a nice way to have GIT repos referenced in SVN. I never tried though.
I'm not really sure what you're talking about.
But merges in git and svn are incompatible. So if I want to have git-svn cooperation I have to keep my history linear.

The idea of the topic is if you can think of a way this operator= could brake something. I'll post the full changes when I've made it stable enough.
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Request for review: cbProject::operator=
« Reply #13 on: November 21, 2014, 09:45:58 am »
So... I've no idea whether its related or not, but I've done an SVN update, then applied your patch and since that day C::B freezes for me rather often on Windows. It froze when I opened a settings dialog (editor), when the build completed and just during normal (editing) operation.

Something has become really unstable... :-\
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Request for review: cbProject::operator=
« Reply #14 on: November 21, 2014, 10:12:10 am »
Try the easiest thing - run cb without my patch. My patch should not cause any problems, because operator= is not used anywhere in the code. And if was used it will be even worse with the old version.
(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!]