← Back to team overview

kicad-developers team mailing list archive

Mac & "invalid context"


Hi again,

I've been digging deeper into this issue and think I found the cause of my problems with invalid graphic contexts: The Mac port of wxWidgets does not support having nested contexts (wxDC instances). In short, this means that the following is illegal and any draw command will fail:
wxClientDC dc(this);
wxClientDC dc2(this);
<- draw something here;

One example of where this is done in KiCad (this seems to be done all over the place):
wxClientDC dc( DrawPanel );

This function eventually calls WinEDA_BasePcbFrame::Compile_Ratsnest( wxDC* DC ...), which again calls WinEDA_MsgPanel::EraseMsgBox(), which creates a new context:
wxClientDC dc( this );

This one is easy to fix, but there are more, to an unknown extent.

In general (I'm not familiar with wxWidgets), it's considered nice to only draw stuff on the paint event itself. I guess this school of thought is not followed in KiCad, either accidentally or for some reason.

I'm wondering if anyone has any insights, ideas etc. about what to do about this?


~/= Marius

We are Elektropeople for a better living.

Follow ups