Following code causes crash of FreeCAD(0.18), when line with removeObject is executed - Therefore I have it commented:
(This is not the "real" code - I extracted it to show the problem.)
Code: Select all
objectAnn=None
import DraftSnap
class Ui_Dialog:
def start():
snapit(0)
def cb(point):
print("cb called by Snapper", point)
if point.__class__.__name__ == 'Vector':
print("Snapper clicked")
objectAnn.LabelText=["New Text"] #This works
# App.ActiveDocument.removeObject(objectAnn.Label) #THIS MAKES CRASH !!!!!!!!!!!!!!!!!!!!!!1
FreeCAD.ActiveDocument.recompute()
return(print("End cb"))
def snapit(i):
global objectAnn
objectAnn = App.ActiveDocument.addObject("App::AnnotationLabel","FCInfoToMouse")
objectAnn.LabelText=["Einfügepunkt klicken"]
point = FreeCADGui.Snapper.getPoint(callback = Ui_Dialog.cb) #snapit runs through and does not wait here till clicked
print("Line after Snapper",objectAnn.Label)
what = Ui_Dialog
what.start()
I tried it on two Intel-PC's : Win10 with Intel(R) UHD Graphics 620; Win7 with Nvidia GeForce GT 540M)Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Access violation
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Access violation
and an AMD-PC(Win 7,AMD-RadeonR7), always same error.
Is there a solution?