mac 2,9 "Cannot nest wxDCs on the same window"
Stefan Csomor
csomor at advancedconcepts.ch
Mon Oct 1 21:52:36 PDT 2007
Hi
> On Mon, 01 Oct 2007 09:55:15 -0700 Robin Dunn <robin at alldunn.com> wrote:
>
> RD> Riccardo Cohen wrote:
> RD> > Hi
> RD> > I have a program that works on wxmac2,7 , but with 2,9 it displays the
> RD> > following assertion : "Cannot nest wxDCs on the same window"
> RD> >
> RD> > this happens when I do
> RD> >
> RD> > wxClientDC *dc=new wxClientDC(diag);
> RD> > dc->DrawRectangle(rec);
> RD> > delete(dc);
> RD> >
> RD> > inside a timer_wake event.
> RD> > I do not understand exactly what it means.
> RD>
> RD> You can not have more than one wxDC active at the same time for the same
> RD> window. Somewhere you have another DC already using diag when the code
> RD> above is called.
>
> This seems like a rather bad restriction. I wonder if we couldn't make
> all wxClientDC instances on the same window use the same underlying
> CGContext somehow. It could still result in problems with changing DC
> attributes but if we restored them carefully, it would allow something
> (common) like this:
>
I've tried this in earlier times, but I was not successful when another context for another wxWindow on the same toplevel window that was currently drawing was requested, but since now all code is Quartz only, I could try again.
Neverthelesss I really think that every drawing has to be moved to a OnPaint event, and the only reason to use a dc outside is for measuring purposes, which already can be done. It is the way the new drawing systems perform optimally, intermittent drawing leads to synchronization bottlenecks.
Best,
Stefan
More information about the wx-users
mailing list