Line app.info() create crash in FlatCAM

Issue #254 resolved
Marius Stanciu created an issue

FlatCAM master branch, Win10 x64, Python3.6

The usage of the following line (or one similar to this one) for example in FlatCAMObj.FlatCAMGerber.isolate():

app_obj.info("Isolation geometry created: %s" % geo_obj.options["name"])

causes FlatCAM to crash now and then. Not consistently.

The only information's provided are in the PyCharm IDE:

[DEBUG][Dummy-2] 0.000998 seconds before initialize().
[DEBUG][MainThread] on_object_created()
[DEBUG][MainThread] on_object_created --> OC.append()
QPixmap: It is not safe to use pixmaps outside the GUI thread
[DEBUG][MainThread] append --> OC.get_names()
[DEBUG][MainThread] FlatCAMGeometry.set_ui()
[DEBUG][Dummy-1] A new object is available. Should plot it!
[DEBUG][MainThread] plot --> FlatCAMObj.plot()
[DEBUG][Dummy-1] Canvas update requested: [0, 0, 0, 0, 0]
[DEBUG][Dummy-1] Size: (654.3939393939393, 287.0) [px]
[DEBUG][Dummy-1] Density: (0.05961964343588693, 0.05879442508701569) [units/px]
[DEBUG][MainThread] on_zoom_fit--> OC.get_bounds()
[DEBUG] Geometry->bounds()
[DEBUG] Geometry->bounds()
[DEBUG] Geometry->bounds()

Process finished with exit code -1073741819 (0xC0000005)

As it can be seen, there is a line saying:

"QPixmap: It is not safe to use pixmaps outside the GUI thread"

The issue could be seen by running a Tcl command from Tcl Shell a few times (until crash)

isolate test.gbr -dia 0.1 -passes 3 -overlap 0.05 

After using the command like 3 times on a simple Gerber file that I use for testing I just got this:

crash.JPG

Commenting the line:

app_obj.info("Isolation geometry created: %s" % geo_obj.options["name"])

solve the issue.

Comments (7)

  1. Juan Pablo Caram repo owner
    • fixing issue #254
    • replaced (as per advice from @jpcgt) the lines with app.info call to using a signal which is safe to use in a threaded environment, app.inform.emit()

    → <<cset c85a142759ae>>

  2. Log in to comment