Commit 96c1a50e authored by Miguel Angel Ajo's avatar Miguel Angel Ajo

BOARD::Add now it's wrapped in python and clears the .thisown flag on python...

BOARD::Add now it's wrapped in python and clears the .thisown flag on python to avoid GC from deleting the object later (BOARD will do)
parent 173b869d
* add MODULE::Add (see BOARD:Add), to make it more clean
* Tell swig(somehow) to forget automatic object deletion after adding * Tell swig to forget automatic object deletion after adding
a BOARD_ITEM to BOARD object (it will be automatically deleted by BOARD, a BOARD_ITEM to MODULE object (it will be automatically deleted by MODULE,
leading to Segmentation Fault when unloading our python module (double free). leading to Segmentation Fault when unloading our python module (double free).
* implement iterator for NETCLASSES (NETCLASS) see class_netclass.h It seems that we must do object.thisown=0 when added, may be adding a wrapper
Add function.
* add MODULE::Add (see BOARD:Add), to make it more clean
* Implement iterator for NETCLASSES (NETCLASS) see class_netclass.h
* Saving modules to library (in librairi.cpp) * Saving modules to library (in librairi.cpp)
...@@ -22,5 +25,6 @@ ...@@ -22,5 +25,6 @@
to kicad plugin? to kicad plugin?
void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewModulesOnly )
...@@ -45,6 +45,15 @@ ...@@ -45,6 +45,15 @@
def Save(self,filename): def Save(self,filename):
return SaveBoard(filename,self) return SaveBoard(filename,self)
#
# add function, clears the thisown to avoid python from deleting
# the object in the garbage collector
#
def Add(self,item):
item.thisown=0
self.AddNative(item)
} }
} }
...@@ -57,6 +66,7 @@ ...@@ -57,6 +66,7 @@
%rename(Get) operator MODULE*; %rename(Get) operator MODULE*;
%rename(Get) operator SEGZONE*; %rename(Get) operator SEGZONE*;
// we must translate C++ templates to scripting languages // we must translate C++ templates to scripting languages
%template(BOARD_ITEM_List) DLIST<BOARD_ITEM>; %template(BOARD_ITEM_List) DLIST<BOARD_ITEM>;
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
%ignore BOARD_ITEM::ZeroOffset; %ignore BOARD_ITEM::ZeroOffset;
%ignore D_PAD::m_PadSketchModePenSize; %ignore D_PAD::m_PadSketchModePenSize;
%rename(AddNative) *::Add;
// this is what it must be included in the wrapper .cxx code to compile // this is what it must be included in the wrapper .cxx code to compile
%{ %{
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
%rename(getWxRect) operator wxRect; %rename(getWxRect) operator wxRect;
%ignore operator <<; %ignore operator <<;
%ignore operator =; %ignore operator=;
%{ %{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment