File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class QgsMessageBar: QFrame
13
13
* @param widget widget to add
14
14
* @param level is 0 for information, 1 for warning, 2 for critical
15
15
*/
16
- void pushWidget( QWidget *widget, int level = 0 );
16
+ void pushWidget( QWidget *widget /Transfer/ , int level = 0 );
17
17
18
18
/*! remove the passed widget from the bar (if previously added),
19
19
* then display the next one in the stack if any or hide the bar
Original file line number Diff line number Diff line change @@ -90,6 +90,11 @@ void QgsMessageBar::popItem( QgsMessageBarItem *item )
90
90
{
91
91
mLayout ->removeWidget ( mCurrentItem ->widget () );
92
92
mCurrentItem ->widget ()->hide ();
93
+ if ( mCurrentItem ->widget ()->parent () == this )
94
+ {
95
+ delete mCurrentItem ->widget ();
96
+ }
97
+ delete mCurrentItem ;
93
98
mCurrentItem = 0 ;
94
99
}
95
100
@@ -126,6 +131,10 @@ bool QgsMessageBar::popWidget( QWidget *widget )
126
131
if ( item->widget () == widget )
127
132
{
128
133
mList .removeOne ( item );
134
+ if ( item->widget ()->parent () == this )
135
+ {
136
+ delete item->widget ();
137
+ }
129
138
delete item;
130
139
return true ;
131
140
}
@@ -141,7 +150,6 @@ bool QgsMessageBar::popWidget()
141
150
142
151
QgsMessageBarItem *item = mCurrentItem ;
143
152
popItem ( item );
144
- delete item;
145
153
146
154
return true ;
147
155
}
You can’t perform that action at this time.
0 commit comments