Fix crash: In Xref link widget, If there is an element being added (element pose mode), and this one is compatible with the type of Xref sought by the widget, then the widget show this element.

When user finish the element pose mode, the element under the cursor is deleted, but continue to be show by the widget.
So, click on this element in the widget cause a crash.
This case come when user add element and go to another diagram without finish the pose mode, and open Xref link widget from an element in this other diagram. 


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4993 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2017-07-26 08:55:32 +00:00
parent 4c56ebf353
commit a69e39cd2f
4 changed files with 24 additions and 4 deletions

View File

@@ -989,15 +989,22 @@ void ProjectView::rebuildDiagramsMap() {
* we display the fallback widget.
* @param tab_id
*/
void ProjectView::tabChanged(int tab_id) {
void ProjectView::tabChanged(int tab_id)
{
if (tab_id == -1)
setDisplayFallbackWidget(true);
else if(m_tab->count() == 1)
setDisplayFallbackWidget(false);
emit(diagramActivated(m_diagram_ids[tab_id]));
if (m_diagram_ids[tab_id] != nullptr)
m_diagram_ids[tab_id]->diagram()->diagramActivated();
//Clear the event interface of the previous diagram
if (DiagramView *dv = m_diagram_ids[m_previous_tab_index])
dv->diagram()->clearEventInterface();
m_previous_tab_index = tab_id;
}
/**