Skip to content
Permalink
Browse files
Fix crash QsciAPIs is destroyed while worker running
  • Loading branch information
elpaso committed Jul 6, 2021
1 parent e1a8ef5 commit 9adbdfa8bff701065832896b24a4ed8d31854315
@@ -31,6 +31,9 @@ code autocompletion.
Constructor for QgsCodeEditorSQL
%End


virtual ~QgsCodeEditorSQL();

void setFields( const QgsFields &fields );
%Docstring
Set field names to be added to the lexer API.
@@ -34,6 +34,14 @@ QgsCodeEditorSQL::QgsCodeEditorSQL( QWidget *parent )
QgsCodeEditorSQL::initializeLexer(); // avoid cppcheck warning by explicitly specifying namespace
}

QgsCodeEditorSQL::~QgsCodeEditorSQL()
{
if ( mApis )
{
mApis->cancelPreparation( );
}
}

void QgsCodeEditorSQL::initializeLexer()
{
QFont font = lexerFont();
@@ -39,6 +39,9 @@ class GUI_EXPORT QgsCodeEditorSQL : public QgsCodeEditor
//! Constructor for QgsCodeEditorSQL
QgsCodeEditorSQL( QWidget *parent SIP_TRANSFERTHIS = nullptr );


virtual ~QgsCodeEditorSQL();

/**
* Set field names to be added to the lexer API.
*
@@ -105,8 +105,6 @@ void TestQgsQueryResultWidget::testWidgetCrash()
QTimer::singleShot( 1, d.get(), [ & ] { exited = true; } );
while ( ! exited )
QgsApplication::processEvents();
// This prevents a crash in Qsci internal thread
std::this_thread::sleep_for( std::chrono::seconds( 1 ) );
}


0 comments on commit 9adbdfa

Please sign in to comment.