Never (ever) refactoring class to "separate set of dedicated source files" ever again
-
This tragedy of course had to happen just before my daily commit at the end of the day and the end of the work week. I've noticed quirkyness in the refactor feature up till now, but this one takes the cake:
I had a simple class that had a few simple methods, a single member variable and a few accessors. It was properly guarded, and I thought I'd give it a separate source/header since it was planned to increase to larger size in the near future.
So, I did the usual refactor to dedicated source/header files. And what happens is horrifying. It proceeded to write (over and over (and over)) into the "new" source and header files, not only that class, but the other MAIN class that was defined after it.
Which would have been fine, but it did this recursively.
I had to manually KILL qtcreator to stop it.
When I came back into the project and loaded the class files, the original was empty, and the "new separate set of source/header files" were the entirety of the remainder, all cut up in seemingly random order and swapped all over the place, repeated.
This was a <20 lines class that I was refactoring, I ended up with 171,598 lines in EACH the source AND the header. Now both the refactored and MAIN classes are mangled together in a way I probably can't undo because I had to kill the program to stop it from endlessly "refactoring".
Long story short, I lost a whole days worth of work and wouldn't you know it would be the day this week that I got the most work done and was about clock out for the holiday weekend. I'll now have to spend all night fixing it just so my workload doesn't come crashing down on my before the next holiday.
And yes I know, I should have done commits sooner, but when you are on a roll, the last thing you are expecting is a simple refactoring of a tiny class to do you in. And I am usually good about it, and have avoided such problems from commiting every day.
But this certainly cancels out ALL the time I had "saved" with refactoring in this project.I won't be able to in good faith every use it again unless I want to drop out and commit just beforehand each time I want to make such a small change, but if that's the case it isn't worth it anyway.
I'm just disappointed there's no simple detection for a infinite loop, it was obviously going way to far to the point that even a simple detection should have picked up on that. The original involved source files were 200 + 20 lines, and even by 171k lines it still thought "its all good"? how?? ;o;
Even if you doubly go over the classes in the entire project it doesn't come anywhere near that. So, farewell refactoring :3
-
@osirisgothra said in Never (ever) refactoring class to "separate set of dedicated source files" ever again:
Long story short, I lost a whole days worth of work
That's why there are version control systems like Git out there.
Just commit your changes regularly, especially before doing bigger/risky changes.What you describe sounds like a bug in QtCreator, you should create a bug ticket in https://bugreports.qt.io/secure/Dashboard.jspa