The general a good rule of thumb is, if you make a method call from a
thread, and it changes anything in the UI, should be executed via
executeInMainThread
..but callbacks should all be executed in the main thread, so this
should be unecessary (e.g try "import time; time.sleep(2)" in a PyScript
button - it locks up the UI)
This is definitely a bug:
set cut_paste_input [stack 0]
version 6.3 v5
push $cut_paste_input
NoOp {
name crashy
addUserKnob {20 User}
addUserKnob {22 segfault T nuke.scriptClear() +STARTLINE}
}
..but doing nuke.executeInMainThread(nuke.scriptClear) crashes
identically for me
A bit unrelated, but you don't need to use executeInMainThread for
PyQt/PySide stuff any more, I guess since they now share an event-loop,
instead PyQt running in it's own event loop in another thread(?):
http://docs.thefoundry.co.uk/nuke/63/pythondevguide/custom_panels.html#migrating-from-qt-applications-nuke-6-2
On 11/01/12 08:17, Alex Schworer wrote:
> Howdy --
>
> I have fairly complex piece of code that, when run as a result of a button
> callback on a gizmo will cause a segfault in Nuke. If I wrap that code in a
> call to executeInMainThread, it runs fine. Also, I can run the code in the
> script editor without a segfault. I've narrowed down the segfault to a part
> in the code where I call:
> nuke.scriptClear()
> nuke.scriptOpen(new_script_path)
>
> So, my question is this: are there a set of rules or guidelines to follow
> that tell us when we should wrap our code in an executeInMainThread? I don't
> want to just start blindly wrapping stuff that fails in executeInMainThread
> without knowing why I'm doing it. I've done a bit of googling, and see that
> it was mandatory to run PyQt apps in a separate thread and use
> executeInMainThread, but no guidelines that are more general than that.
>
> Cheers
> --alex_______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
--
ben dickson
2D TD | [email protected]
rising sun pictures | www.rsp.com.au
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python