Skip to content

Commit d43d306

Browse files
committedJun 12, 2014
Fix #10548 (crash using custom forms)
When using a custom UI file, the widget is created beforehand, and the code was failing to initialize it.
1 parent 4f91399 commit d43d306

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎src/gui/editorwidgets/core/qgswidgetwrapper.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@ QgsWidgetWrapper::QgsWidgetWrapper( QgsVectorLayer* vl, QWidget* editor, QWidget
2323
, mWidget( editor )
2424
, mParent( parent )
2525
, mLayer( vl )
26+
, mInitialized( false )
2627
{
2728
}
2829

2930
QWidget* QgsWidgetWrapper::widget()
3031
{
3132
if ( !mWidget )
32-
{
3333
mWidget = createWidget( mParent );
34+
35+
if ( !mInitialized )
36+
{
3437
mWidget->setProperty( "EWV2Wrapper", QVariant::fromValue<QgsWidgetWrapper*>( this ) );
3538
initWidget( mWidget );
39+
mInitialized = true;
3640
}
3741

3842
return mWidget;

‎src/gui/editorwidgets/core/qgswidgetwrapper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class GUI_EXPORT QgsWidgetWrapper : public QObject
163163
QWidget* mWidget;
164164
QWidget* mParent;
165165
QgsVectorLayer* mLayer;
166+
bool mInitialized;
166167
};
167168

168169
// We'll use this class inside a QVariant in the widgets properties

0 commit comments

Comments
 (0)
Please sign in to comment.