diff --git a/include/eepp/ui/uidropdownlist.hpp b/include/eepp/ui/uidropdownlist.hpp index c8dc0c100..8308dc42f 100644 --- a/include/eepp/ui/uidropdownlist.hpp +++ b/include/eepp/ui/uidropdownlist.hpp @@ -59,6 +59,7 @@ class EE_API UIDropDownList : public UITextInput { StyleConfig mStyleConfig; UIListBox* mListBox; UINode* mFriendNode; + Uint32 mListBoxCloseCb{ 0 }; void onListBoxFocusLoss( const Event* Event ); diff --git a/src/eepp/system/process.cpp b/src/eepp/system/process.cpp index 03939016d..f7bdf01cf 100644 --- a/src/eepp/system/process.cpp +++ b/src/eepp/system/process.cpp @@ -180,9 +180,11 @@ bool Process::join( int* const returnCodeOut ) { } bool Process::kill() { + if ( mProcess == nullptr ) + return true; + eeASSERT( mProcess != nullptr ); mShuttingDown = true; subprocess_init_shutdown( PROCESS_PTR ); - eeASSERT( mProcess != nullptr ); if ( PROCESS_PTR->alive ) { destroy(); return 0 == subprocess_terminate( PROCESS_PTR ); diff --git a/src/eepp/ui/doc/documentview.cpp b/src/eepp/ui/doc/documentview.cpp index 2f909d123..43ec363ba 100644 --- a/src/eepp/ui/doc/documentview.cpp +++ b/src/eepp/ui/doc/documentview.cpp @@ -402,7 +402,8 @@ double DocumentView::getLineYOffset( Int64 docIdx, Float lineHeight ) const { bool DocumentView::isLineVisible( Int64 docIdx ) const { return mDocLineToVisibleIndex.empty() || - mDocLineToVisibleIndex[docIdx] != static_cast( VisibleIndex::invalid ); + ( docIdx < mDocLineToVisibleIndex.size() && mDocLineToVisibleIndex[docIdx] != + static_cast( VisibleIndex::invalid ) ); } std::vector DocumentView::intersectsFoldedRegions( const TextRange& range ) const { diff --git a/src/eepp/ui/uidropdownlist.cpp b/src/eepp/ui/uidropdownlist.cpp index ca546f126..9cd74b451 100644 --- a/src/eepp/ui/uidropdownlist.cpp +++ b/src/eepp/ui/uidropdownlist.cpp @@ -47,7 +47,8 @@ UIDropDownList::UIDropDownList( const std::string& tag ) : [this] ( auto event ) { onItemKeyDown( event ); } ); mListBox->addEventListener( Event::KeyDown, [this] ( auto event ) { onItemKeyDown( event ); } ); mListBox->addEventListener( Event::OnClear, [this] ( auto event ) { onWidgetClear( event ); } ); - mListBox->addEventListener( Event::OnClose, [this]( const Event* ) { mListBox = nullptr; } ); + mListBoxCloseCb = mListBox->addEventListener( Event::OnClose, + [this]( const Event* ) { mListBox = nullptr; } ); mListBox->addEventListener( Event::OnSelectionChanged, [this]( auto ) { if ( !mListBox->hasSelection() ) mListBox->setSelected( 0 ); @@ -60,6 +61,8 @@ UIDropDownList::UIDropDownList( const std::string& tag ) : } UIDropDownList::~UIDropDownList() { + if ( mListBox != nullptr && mListBoxCloseCb ) + mListBox->removeEventListener( mListBoxCloseCb ); destroyListBox(); } diff --git a/src/thirdparty/subprocess/subprocess.h b/src/thirdparty/subprocess/subprocess.h index 0b68cd505..64bd03b2f 100644 --- a/src/thirdparty/subprocess/subprocess.h +++ b/src/thirdparty/subprocess/subprocess.h @@ -1059,12 +1059,13 @@ int subprocess_join(struct subprocess_s *const process, process->hStdInput = SUBPROCESS_NULL; } - WaitForSingleObject(process->hProcess, infinite); + if (process->hProcess) { + WaitForSingleObject( process->hProcess, infinite ); + } if (out_return_code) { - if (!GetExitCodeProcess( - process->hProcess, - SUBPROCESS_PTR_CAST(unsigned long *, out_return_code))) { + if (process->hProcess && !GetExitCodeProcess(process->hProcess, + SUBPROCESS_PTR_CAST(unsigned long *, out_return_code))) { return -1; } } @@ -1128,18 +1129,22 @@ int subprocess_destroy(struct subprocess_s *const process) { if (process->hStdInput) { CloseHandle(process->hStdInput); + process->hStdInput = SUBPROCESS_NULL; } if (process->hEventInput) { CloseHandle(process->hEventInput); + process->hEventInput = SUBPROCESS_NULL; } if (process->hEventOutput) { CloseHandle(process->hEventOutput); + process->hEventOutput = SUBPROCESS_NULL; } if (process->hEventError) { CloseHandle(process->hEventError); + process->hEventError = SUBPROCESS_NULL; } } #endif diff --git a/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp b/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp index 468226d56..14fe5b6f9 100644 --- a/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp +++ b/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp @@ -1236,7 +1236,7 @@ AutoCompletePlugin::SymbolsList AutoCompletePlugin::getDocumentSymbols( TextDocu std::string current( getPartialSymbol( doc ) ); TextPosition end = doc->getSelection().end(); for ( Int64 i = 0; i < static_cast( doc->linesCount() ); i++ ) { - const auto& string = doc->line( i ).toUtf8(); + auto string = doc->line( i ).toUtf8(); for ( auto& match : pattern.gmatch( string ) ) { std::string matchStr( match[0] ); // Ignore the symbol if is actually the current symbol being written