← Back to team overview

kicad-developers team mailing list archive

Re: Mac & "invalid context"

 

Marius Kintel a écrit :
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):
WinEDA_PcbFrame::Files_io()
{
[...]
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 this case, the Devices Contexts are differents...
The first DC is relative to the main draw area (the main panel), and the second is relative to an other panel.

But , of course, it is possible the case you describe exists in some functions.
If i find such functions, i'll remove the duplicate DC.

--

Jean-Pierre CHARRAS

Maître de conférences
Directeur d'études 2ieme année.
Génie Electrique et Informatique Industrielle 2
Institut Universitaire de Technologie 1 de Grenoble
BP 67, 38402 St Martin d'Heres Cedex

Recherche :
GIPSA-LIS - INPG
46, Avenue Félix Viallet
38031 Grenoble cedex








Follow ups

References