Fix for crash due to pcbnew_action_plugin object tracking
pcbnew_action_plug tracks items that were modified within a plugin. In the case of deletion, the old object is no longer valid. This commit turns off the call to delete if a plugin is active.
This commit is contained in:
parent
935a5cada8
commit
9d98fe1b80
|
@ -44,6 +44,9 @@ void ACTION_PLUGIN::register_action()
|
|||
std::vector<ACTION_PLUGIN*> ACTION_PLUGINS::m_actionsList;
|
||||
|
||||
|
||||
bool ACTION_PLUGINS::m_actionRunning = false;
|
||||
|
||||
|
||||
ACTION_PLUGIN* ACTION_PLUGINS::GetAction( int aIndex )
|
||||
{
|
||||
return m_actionsList[aIndex];
|
||||
|
@ -147,3 +150,15 @@ bool ACTION_PLUGINS::deregister_object( void* aObject )
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool ACTION_PLUGINS::IsActionRunning()
|
||||
{
|
||||
return ACTION_PLUGINS::m_actionRunning;
|
||||
}
|
||||
|
||||
|
||||
void ACTION_PLUGINS::SetActionRunning( bool aRunning )
|
||||
{
|
||||
ACTION_PLUGINS::m_actionRunning = aRunning;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
* ACTION_PLUGIN system wide static list
|
||||
*/
|
||||
static std::vector<ACTION_PLUGIN*> m_actionsList;
|
||||
|
||||
static bool m_actionRunning;
|
||||
public:
|
||||
/**
|
||||
* Function register_action
|
||||
|
@ -168,6 +168,18 @@ public:
|
|||
* @return the number of actions available into the system
|
||||
*/
|
||||
static int GetActionsCount();
|
||||
|
||||
/**
|
||||
* Function IsActionRunning
|
||||
* @return Is an action running right now
|
||||
*/
|
||||
static bool IsActionRunning();
|
||||
|
||||
/**
|
||||
* Function SetActionRunning
|
||||
* @param aRunning sets whether an action is running now.
|
||||
*/
|
||||
static void SetActionRunning( bool aRunning );
|
||||
};
|
||||
|
||||
#endif /* PCBNEW_ACTION_PLUGINS_H */
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
Remove(self, BOARD_ITEM)
|
||||
"""
|
||||
self.RemoveNative(item)
|
||||
item.thisown=1
|
||||
if (not IsActionRunning()):
|
||||
item.thisown=1
|
||||
|
||||
def Delete(self,item):
|
||||
"""
|
||||
|
|
|
@ -230,7 +230,9 @@ void PCB_EDIT_FRAME::OnActionPlugin( wxCommandEvent& aEvent )
|
|||
itemsList.ClearItemsList();
|
||||
|
||||
// Execute plugin himself...
|
||||
ACTION_PLUGINS::SetActionRunning( true );
|
||||
actionPlugin->Run();
|
||||
ACTION_PLUGINS::SetActionRunning( false );
|
||||
|
||||
currentPcb->m_Status_Pcb = 0;
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <macros.h>
|
||||
#include <stdlib.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <action_plugin.h>
|
||||
|
||||
static PCB_EDIT_FRAME* s_PcbEditFrame = NULL;
|
||||
|
||||
|
@ -135,3 +136,9 @@ void UpdateUserInterface()
|
|||
if( s_PcbEditFrame )
|
||||
s_PcbEditFrame->UpdateUserInterface();
|
||||
}
|
||||
|
||||
|
||||
bool IsActionRunning()
|
||||
{
|
||||
return ACTION_PLUGINS::IsActionRunning();
|
||||
}
|
||||
|
|
|
@ -69,4 +69,9 @@ void WindowZoom( int xl, int yl, int width, int height );
|
|||
*/
|
||||
void UpdateUserInterface();
|
||||
|
||||
/**
|
||||
* Are we currently in an action plugin?
|
||||
*/
|
||||
bool IsActionRunning();
|
||||
|
||||
#endif // __PCBNEW_SCRIPTING_HELPERS_H
|
||||
|
|
Loading…
Reference in New Issue