- edited description
Line app.info() create crash in FlatCAM
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:
Commenting the line:
app_obj.info("Isolation geometry created: %s" % geo_obj.options["name"])
solve the issue.
Comments (7)
-
reporter -
reporter - edited description
-
repo owner Ok. The problem is that
FlatCAMApp.info()
should never be called directly. Instead, use the signalFlatCAMApp.inform
. For example see https://bitbucket.org/jpcgt/flatcam/src/master/FlatCAMApp.py#lines-1186We should do a search for any usage of
FlatCAMApp.info()
and emit the signal instead. -
repo owner I forgot to explain:
FlatCAMApp.info()
changes the GUI, therefore it cannot be called from other threads. Passing signals is thread-safe though, andFlatCAMApp.info()
is set to be the handler of the signalFlatCAMApp.inform
. See https://bitbucket.org/jpcgt/flatcam/src/master/FlatCAMApp.py#lines-502 -
reporter Thanks, I'll do that :)
-
repo owner - changed status to resolved
- 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>>
-
repo owner Merged in marius_stanciu/flatcam_mpl/fix_calls_to_info() (pull request #96)
Fix issue
#254→ <<cset 8a9c4b464844>>
- Log in to comment