TechDraw to Master

Merged, abandoned or rejected pull requests are moved here to clear the main Pull Requests forum.
User avatar
sgrogan
Posts: 6084
Joined: Wed Oct 22, 2014 5:02 pm

Re: TechDraw to Master

Postby sgrogan » Fri Jul 01, 2016 12:15 am

blacey wrote:For some reason, GitHub won't let me create a pull request against WandererFan's repo
wmayer had the same problem. Patch works, all self-tests pass installed and uninstalled
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7897 (Git)
Build type: Release
Branch: measure-fix
Hash: 0c327bfc78beba236cc864065b7f0c3e98530493
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
"fight the good fight"
User avatar
wandererfan
Posts: 4078
Joined: Tue Nov 06, 2012 5:42 pm

Re: TechDraw to Master

Postby wandererfan » Fri Jul 01, 2016 2:18 am

Patch to Measure/Cmakelists.txt pushed.
wmayer
Site Admin
Posts: 16436
Joined: Thu Feb 19, 2009 10:32 am

Re: TechDraw to Master

Postby wmayer » Fri Jul 01, 2016 10:32 am

Found two minor things to fix:
In struct WalkerEdge (EdgeWalker.h) the type of v1 and v2 should be changed from int to std::size_t to fix a "possible loss of data" warning.
In DrawViewPart.h there is a forward declaration of WalkerEdge using the class keyword. This should be changed to struct.
wmayer
Site Admin
Posts: 16436
Joined: Thu Feb 19, 2009 10:32 am

Re: TechDraw to Master

Postby wmayer » Fri Jul 01, 2016 10:49 am

I found a critical bug:
1. New document
2. Insert new default drawing view
=> crash in DrawSVGTemplate::execute(void)

The crash happens in line 206 during the second iteratation

Code: Select all

        // Find editable texts
        while (boost::regex_search(begin, end, what, e1)) { // <<=== crash!
            // if we have a replacement value for the text we've found
            if (subs.count(what[1].str())) {
                 // change it to specified value
                 boost::regex e2 ("(<text.*?freecad:editable=\"" + what[1].str() + "\".*?<tspan.*?)>(.*?)(</tspan>)");
                 outfragment = boost::regex_replace(outfragment, e2, "$1>" + subs[what[1].str()] + "$3");
            }
            begin = what[0].second;
        }
MSVC gives the error message: string iterator not dereferencable

When using the "Insert new drawing page from template" command and you press cancel afterwards there should be no error dialog. When using one of the templates the application at the same location.
User avatar
wandererfan
Posts: 4078
Joined: Tue Nov 06, 2012 5:42 pm

Re: TechDraw to Master

Postby wandererfan » Fri Jul 01, 2016 3:36 pm

Fixed & Pushed:
-In struct WalkerEdge (EdgeWalker.h) the type of v1 and v2 should be changed from int to std::size_t to fix a "possible loss of data" warning.
-In DrawViewPart.h there is a forward declaration of WalkerEdge using the class keyword. This should be changed to struct.
-When using the "Insert new drawing page from template" command and you press cancel afterwards there should be no error dialog.

Pending
-MSVC gives the error message: string iterator not dereferencable
Cannot reproduce. Did you set a default template in Preferences? We did have a problem parsing some Drawing templates for EditableTexts, but the ones in .../data/Mod/TechDraw/Templates (names *TD.svg) should be fine.

????
-When using one of the templates the application at the same location.
Does it fail for templates other than the default?
wmayer
Site Admin
Posts: 16436
Joined: Thu Feb 19, 2009 10:32 am

Re: TechDraw to Master

Postby wmayer » Fri Jul 01, 2016 4:29 pm

????
-When using one of the templates the application at the same location.
Does it fail for templates other than the default?
Forgot the word "crash". So, when selecting any of the templates then it crashes at the same location.
User avatar
sgrogan
Posts: 6084
Joined: Wed Oct 22, 2014 5:02 pm

Re: TechDraw to Master

Postby sgrogan » Fri Jul 01, 2016 5:34 pm

I can't reproduce the crash with either the previous commit set or the newest one.
I did notice a small thing I get a warning in report view when adding an horizontal dimension. The icon is visible in the toolbar and the dimension is created

Code: Select all

Cannot find icon: TechDraw_Dimension_Horizonatal
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7899 (Git)
Build type: Release
Branch: TechDraw
Hash: 95c62fc870b2cdea15a0ead07b33390a0ca023c2
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
"fight the good fight"
User avatar
wandererfan
Posts: 4078
Joined: Tue Nov 06, 2012 5:42 pm

Re: TechDraw to Master

Postby wandererfan » Fri Jul 01, 2016 8:24 pm

sgrogan wrote:Cannot find icon: TechDraw_Dimension_Horizonatal
Fixed and pushed.

OS: Ubuntu 12.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7801 +99 (Git)
Build type: debug
Branch: TechDraw
Hash: 166704cca46f0693332cd4422ebfc9829bc6a691
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
OCC version: 7.0.0
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: TechDraw to Master

Postby triplus » Fri Jul 01, 2016 11:47 pm

I created test build (defaults) on Ubuntu 16.04 and the interesting thing is TechDraw is not available after build. Will look into it tomorrow on why as a few days back when i made test build this didn't happen.

And this step will probably be needed on Ubuntu 16.04:

Code: Select all

sudo ln -s  /usr/lib/x86_64-linux-gnu/libproj.so.9.1.0 /usr/lib/x86_64-linux-gnu/libproj.so
P.S. Likely not TechDraw related issue.
wmayer
Site Admin
Posts: 16436
Joined: Thu Feb 19, 2009 10:32 am

Re: TechDraw to Master

Postby wmayer » Sat Jul 02, 2016 8:49 am

I guess I found the reason for the crash:
Before the while loop you write

Code: Select all

        string::const_iterator begin, end;
        begin = outfragment.begin();
        end = outfragment.end();
Then inside the loop you write

Code: Select all

    outfragment = boost::regex_replace(outfragment, e2, "$1>" + subs[what[1].str()] + "$3");
...
begin = what[0].second;
This is very critical because as soon as a new string is assigned to "outfragment" the variable "end" is invalid. And I assume that in this case "what" afterwards is not longer valid either and thus "begin" points to something invalid, too.