TechDraw to Master

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

Re: TechDraw to Master

Post by sgrogan »

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
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: TechDraw to Master

Post by wandererfan »

Patch to Measure/Cmakelists.txt pushed.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: TechDraw to Master

Post by wmayer »

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
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: TechDraw to Master

Post by wmayer »

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
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: TechDraw to Master

Post by wandererfan »

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
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: TechDraw to Master

Post by wmayer »

????
-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
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: TechDraw to Master

Post by sgrogan »

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
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: TechDraw to Master

Post by wandererfan »

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
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: TechDraw to Master

Post by triplus »

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
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: TechDraw to Master

Post by wmayer »

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.
Post Reply