Arch materials

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Arch materials

Post by renatorivo »

Renato Rebelo wrote:the error with the material editor continues, but now I could already see something else, the error message it gives is this:

Arch workbench activated
*** Abort *** an exception was raised, but no catch was found.
... The exception is:SIGSEGV 'segmentation violation' detected. Address 0
same thing for me

OS: Ubuntu 14.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5349 (Git)
Build type: None
Branch: master
Hash: 0c82efe57a264129bc770bdd5a2cbdaf35586729
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a

my bt:

Code: Select all

renato@renato-Unknow:~$ gdb freecad
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from freecad...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/freecad 
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
FreeCAD 0.16, Libs: 0.16R5349 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2015
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[New Thread 0x7fffdaabd700 (LWP 8493)]
[New Thread 0x7fffda2bc700 (LWP 8515)]
[New Thread 0x7fffd9abb700 (LWP 8516)]
[New Thread 0x7fffd92ba700 (LWP 8517)]
[Thread 0x7fffd9abb700 (LWP 8516) exited]
[New Thread 0x7fffd9abb700 (LWP 8582)]
[New Thread 0x7fff77f98700 (LWP 8583)]
[New Thread 0x7fff76fc3700 (LWP 8584)]
[New Thread 0x7fff7532e700 (LWP 8585)]
[New Thread 0x7fff74b2d700 (LWP 8586)]
[New Thread 0x7fff67fff700 (LWP 8587)]
[Thread 0x7fffd92ba700 (LWP 8517) exited]
[Thread 0x7fff7532e700 (LWP 8585) exited]
[Thread 0x7fff74b2d700 (LWP 8586) exited]
Arch workbench activated
[Thread 0x7fff67fff700 (LWP 8587) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77afe58 in QFormInternal::domPropertyToVariant(QFormInternal::QAbstractFormBuilder*, QMetaObject const*, QFormInternal::DomProperty const*) ()
   from /usr/lib/freecad/lib/libFreeCADGui.so
(gdb) bt
#0  0x00007ffff77afe58 in QFormInternal::domPropertyToVariant(QFormInternal::QAbstractFormBuilder*, QMetaObject const*, QFormInternal::DomProperty const*) ()
   from /usr/lib/freecad/lib/libFreeCADGui.so
#1  0x00007ffff775edd9 in QFormInternal::QAbstractFormBuilder::toVariant(QMetaObject const*, QFormInternal::DomProperty*) ()
   from /usr/lib/freecad/lib/libFreeCADGui.so
#2  0x00007ffff7778112 in QFormInternal::QFormBuilder::applyProperties(QObject*, QList<QFormInternal::DomProperty*> const&) ()
   from /usr/lib/freecad/lib/libFreeCADGui.so
#3  0x00007ffff775a1d1 in QFormInternal::FormBuilderPrivate::applyProperties(QObject*, QList<QFormInternal::DomProperty*> const&) ()
   from /usr/lib/freecad/lib/libFreeCADGui.so
#4  0x00007ffff7766230 in QFormInternal::QAbstractFormBuilder::create(QFormInternal::DomWidget*, QWidget*) () from /usr/lib/freecad/lib/libFreeCADGui.so
#5  0x00007ffff7778f31 in QFormInternal::QFormBuilder::create(QFormInternal::DomWidget*, QWidget*) () from /usr/lib/freecad/lib/libFreeCADGui.so
#6  0x00007ffff775a88e in QFormInternal::FormBuilderPrivate::create(QFormInternal::DomWidget*, QWidget*) () from /usr/lib/freecad/lib/libFreeCADGui.so
#7  0x00007ffff77684a3 in QFormInternal::QAbstractFormBuilder::create(QFormInternal::DomUI*, QWidget*) () from /usr/lib/freecad/lib/libFreeCADGui.so
#8  0x00007ffff775a828 in QFormInternal::FormBuilderPrivate::create(QFormInternal::DomUI*, QWidget*) () from /usr/lib/freecad/lib/libFreeCADGui.so
#9  0x00007fff55332e71 in QFormInternal::QAbstractFormBuilder::load(QIODevice*, ---Type <return> to continue, or q <return> to quit---
QWidget*) () from /usr/lib/python2.7/dist-packages/PySide/QtUiTools.so
#10 0x00007fff5532afe2 in QUiLoader::load(QIODevice*, QWidget*) ()
   from /usr/lib/python2.7/dist-packages/PySide/QtUiTools.so
#11 0x00007fff55328263 in ?? ()
   from /usr/lib/python2.7/dist-packages/PySide/QtUiTools.so
#12 0x00007ffff67a20d4 in call_function (oparg=<optimized out>, 
    pp_stack=0x7fffffffb5d0) at ../Python/ceval.c:4020
#13 PyEval_EvalFrameEx (f=f@entry=0x7fff64059e18, throwflag=throwflag@entry=0)
    at ../Python/ceval.c:2666
#14 0x00007ffff67a354d in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fff5c5fb1a8, argcount=1, kws=kws@entry=0x7fff5c7032f0, 
    kwcount=kwcount@entry=1, defs=defs@entry=0x7fff5b463f68, 
    defcount=defcount@entry=3, closure=0x0) at ../Python/ceval.c:3252
#15 0x00007ffff67d87a5 in function_call (func=0x7fff5b5129b0, 
    arg=0x7fff5c5fb190, kw=0x7fff5b469050) at ../Objects/funcobject.c:526
#16 0x00007ffff6744d43 in PyObject_Call (func=func@entry=0x7fff5b5129b0, 
    arg=arg@entry=0x7fff5c5fb190, kw=kw@entry=0x7fff5b469050)
    at ../Objects/abstract.c:2529
#17 0x00007ffff66d07bd in instancemethod_call.8988 (func=0x7fff5b5129b0, 
    arg=0x7fff5c5fb190, kw=0x7fff5b469050) at ../Objects/classobject.c:2602
#18 0x00007ffff6744d43 in PyObject_Call (func=func@entry=0x7fffc0bc9190, 
    arg=arg@entry=0x7ffff7f1c050, kw=kw@entry=0x7fff5b469050)
---Type <return> to continue, or q <return> to quit---
    at ../Objects/abstract.c:2529
#19 0x00007ffff674967f in slot_tp_init.26761 (self=0x7fff5b44e248, 
    args=0x7ffff7f1c050, kwds=0x7fff5b469050) at ../Objects/typeobject.c:5692
#20 0x00007ffff674768f in type_call.26491 (type=<optimized out>, 
    args=0x7ffff7f1c050, kwds=0x7fff5b469050) at ../Objects/typeobject.c:745
#21 0x00007ffff6744d43 in PyObject_Call (func=func@entry=0x2cd5df0, 
    arg=arg@entry=0x7ffff7f1c050, kw=kw@entry=0x7fff5b469050)
    at ../Objects/abstract.c:2529
#22 0x00007ffff679f816 in do_call (nk=<optimized out>, na=0, 
    pp_stack=0x7fffffffbbd0, func=0x2cd5df0) at ../Python/ceval.c:4238
#23 call_function (oparg=<optimized out>, pp_stack=0x7fffffffbbd0)
    at ../Python/ceval.c:4043
#24 PyEval_EvalFrameEx (f=f@entry=0x7fff5b5233f0, throwflag=throwflag@entry=0)
    at ../Python/ceval.c:2666
#25 0x00007ffff67a2059 in fast_function (nk=<optimized out>, na=1, n=1, 
    pp_stack=0x7fffffffbd50, func=0x7fff5b46a1b8) at ../Python/ceval.c:4106
#26 call_function (oparg=<optimized out>, pp_stack=0x7fffffffbd50)
    at ../Python/ceval.c:4041
#27 PyEval_EvalFrameEx (f=f@entry=0x7fff5b447910, throwflag=throwflag@entry=0)
    at ../Python/ceval.c:2666
#28 0x00007ffff67a354d in PyEval_EvalCodeEx (co=<optimized out>, 
    globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fffe45c3428, argcount=1, kws=kws@entry=0x0, 
---Type <return> to continue, or q <return> to quit---
    kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, 
    closure=0x0) at ../Python/ceval.c:3252
#29 0x00007ffff67d86d0 in function_call (func=0x7fff5b500d70, 
    arg=0x7fffe45c3410, kw=0x0) at ../Objects/funcobject.c:526
#30 0x00007ffff6744d43 in PyObject_Call (func=func@entry=0x7fff5b500d70, 
    arg=arg@entry=0x7fffe45c3410, kw=kw@entry=0x0)
    at ../Objects/abstract.c:2529
#31 0x00007ffff66d07bd in instancemethod_call.8988 (func=0x7fff5b500d70, 
    arg=0x7fffe45c3410, kw=0x0) at ../Objects/classobject.c:2602
#32 0x00007ffff6744d43 in PyObject_Call (func=func@entry=0x7fffc0bc9410, 
    arg=arg@entry=0x7ffff7f1c050, kw=<optimized out>)
    at ../Objects/abstract.c:2529
#33 0x00007ffff67bd577 in PyEval_CallObjectWithKeywords (func=0x7fffc0bc9410, 
    arg=0x7ffff7f1c050, kw=<optimized out>) at ../Python/ceval.c:3889
#34 0x00007fffc320d72c in PySide::SignalManager::callPythonMetaMethod(QMetaMethod const&, void**, _object*, bool) ()
   from /usr/lib/x86_64-linux-gnu/libpyside-python2.7.so.1.2
#35 0x00007fffc32138a0 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libpyside-python2.7.so.1.2
#36 0x00007ffff560ea78 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#37 0x00007ffff5eddaf6 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#38 0x00007ffff5ede09c in QAbstractButton::mousePressEvent(QMouseEvent*) ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#39 0x00007ffff5b7b38b in QWidget::event(QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#40 0x00007ffff5b2be2c in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#41 0x00007ffff5b325dd in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#42 0x00007ffff74af09f in Gui::GUIApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/freecad/lib/libFreeCADGui.so
#43 0x00007ffff55fa4dd in QCoreApplication::notifyInternal(QObject*, QEvent*)
    () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#44 0x00007ffff5b31d93 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#45 0x00007ffff5ba69eb in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#46 0x00007ffff5ba6289 in QApplication::x11ProcessEvent(_XEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#47 0x00007ffff5bcdb32 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#48 0x00007fffee40de04 in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#49 0x00007fffee40e048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#50 0x00007fffee40e0ec in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#51 0x00007ffff56277a1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#52 0x00007ffff5bcdbe6 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#53 0x00007ffff55f90af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#54 0x00007ffff55f93a5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#55 0x00007ffff55feb79 in QCoreApplication::exec() ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#56 0x00007ffff74a6a6c in Gui::Application::runApplication() ()
   from /usr/lib/freecad/lib/libFreeCADGui.so
#57 0x0000000000403277 in main ()
(gdb) 
Renato
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Arch materials

Post by yorik »

Guys I'm sorry but I can't solve the problem since I'm unable to reproduce it and therefore see what's wrong. From my point of view everything looks OK. All I can suggest if someone is willing to help to debug this, is to insert a couple of print statements in the code in Mod/Material/MaterialEditor.py, to try to locate which portion of it causes the crash. If someone is willing to try this, I can explain how to do it.
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Arch materials

Post by renatorivo »

Just to be sure that we are talking about the same thing,
all fields accept the pasted texts, just by clicking on the "Paste" icon FreeCAD crashes, and everything disappears.
What should it paste? A complete material or the name only?
Renato
Attachments
material.png
material.png (23.79 KiB) Viewed 2364 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Arch materials

Post by yorik »

I should actually change that icon... It is not htere to paste, but to open the full material editor...
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Arch materials

Post by renatorivo »

yorik wrote:Guys I'm sorry but I can't solve the problem since I'm unable to reproduce it and therefore see what's wrong. From my point of view everything looks OK. All I can suggest if someone is willing to help to debug this, is to insert a couple of print statements in the code in Mod/Material/MaterialEditor.py, to try to locate which portion of it causes the crash. If someone is willing to try this, I can explain how to do it.
sorry, not solved yet :? , can you tell me how to edit Mod/Material/MaterialEditor.py and the next steps? located in usr/lib/freecad/?

Thanks, Renato
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Arch materials

Post by yorik »

renatorivo wrote:can you tell me how to edit Mod/Material/MaterialEditor.py and the next steps? located in usr/lib/freecad/?
Okay so it works like this: when the "paste" button is pressed, which causes the crash, the __init__ function of MaterialEditor (line 48) is launched. One of the lines in that function (between lines 48 and 92) is causing that crash. We must find which one. So the idea is to add this kind of line:

Code: Select all

print "first step reached"
then

Code: Select all

print "second step reached"
somewhere in that interval. For example try placing the first line immediately after the "with a material dictionary.""" " line and the second one after self.updateContents(d).

Then lauch freecad from a terminal, so we can see the output of python even after the main window crashed. If the first line is printed, then the crash occurs without the second line being printed, it means the program never reached the second line. Then we know the problematic line is between the two, right? Then move the lines (for example move the first line to the middle of the code, at line 66) and progressively reduce the interval between the two, until we find the culprit. My suspect is that the last line ( self.updateContents(d) ) causes the crash. In which case you'll need to repeat the procedure in the updateContents function below (line 112). You can of course add more than two of these lines to do things faster.

One thing to be aware,python is sensible to white spaces before the code. So make sure to add your print "..." lines EXACTLY below the rest of the code (that is, with 8 spaces before).

I hope this is clear. Sorry I cannot do this for you, but it would take us months...
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Arch materials

Post by renatorivo »

hi,
it seems that I found the critical line
code:

Code: Select all

        self.material = material
        print "riga uno4"
        self.customprops = []
        print "riga uno5"
        # load the UI file from the same directory as this script
        loader = UiLoader(self)
        print "riga uno6"
        widget = loader.load(os.path.dirname(__file__)+os.sep+"materials-editor.ui")
        print "riga uno6a"
        #QtCore.QMetaObject.connectSlotsByName(widget)
        print "riga uno6b"
        self.ui = self
        print "riga uno7"
report:

Code: Select all


Arch workbench activated
riga uno
riga uno1
riga uno2
riga uno3
riga uno4
riga uno5
riga uno6
*** Abort *** an exception was raised, but no catch was found.
	... The exception is:SIGSEGV 'segmentation violation' detected. Address 0
renato@renato-Unknow:~$ 
"riga uno6a" is not printed
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Arch materials

Post by yorik »

Aha, now we are getting somewhere. Thanks for testing!
Could you please try the following:
1) Check that a materials-editor.ui file exists in the same directory as MaterialEditor.py
2) If yes, try this in the python console of FreeCAD:

Code: Select all

l = FreeCADGui.UiLoader()
w = l.load("/path/to/FreeCAD/Mod/Material/materials-editor.ui")
Using the full path to that file instead of /path/to/FreeCAD/Mod/Material/materials-editor.ui
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Arch materials

Post by renatorivo »

done, nothing changes, unfortunately or have I done something wrong?
Attachments
cartella.png
cartella.png (56.42 KiB) Viewed 2237 times
schermatafreecad.png
schermatafreecad.png (78.23 KiB) Viewed 2237 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Arch materials

Post by yorik »

And if after the above code, you do this, what happens?

Code: Select all

w.show()
Post Reply