Claudia Frank wrote:
> Is there a way to identify which parts of wx are considered not to be
> used in such a case?
Yes - consider the whole library to not have thread safety and
coordinate access to it appropriately. To my knowledge there's no
document which will describe the specific parts of wx that can and can't
be used by secondary threads - such a document would be quite difficult
to create because it often differs by platform. If you just assume that
accessing any wx functionality from a secondary thread isn't allowed,
your life will be a lot easier even if this means writing more code upfront.
Heres what the official wxWidgets documentation has to say about it:
> When writing a multi-threaded application, it is strongly recommended
that no secondary threads call GUI functions. The design which uses one
GUI thread and several worker threads which communicate with the main
one using events is much more robust and will undoubtedly save you
countless problems (example: under Win32 a thread can only access GDI
objects such as pens, brushes, device contexts created by itself and not
by the other threads).
From:
http://docs.wxwidgets.org/3.1.0/overview_thread.html
Alternatively, in this case, you could just access the clipboard using
the native platform's facilities directly rather than going through wx.
I know that on Win32 at least, monitoring clipboard changes is much more
straight forward (and less error-prone) if you set up a clipboard
listener through the Win32 API instead of trying to hack something
together using wx. If cross-platform code is important to you, this
might not be the best approach, but if you're writing something only for
one platform or only for yourself, it might save you the headache.
--
James Scholes
http://twitter.com/JamesScholes