mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Fix indirect memory leak on VertexBufferVBO.
Added a few icons. Tried to detect a bug on the terminal emulator. Fixed Git status when file has been renamed.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 12.0.1, 2024-02-05T02:06:09. -->
|
||||
<!-- Written by QtCreator 12.0.1, 2024-02-05T22:01:26. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
@@ -116,7 +116,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{388e5431-b31b-42b3-b9ad-9002d279d75d}</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">10</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">25</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">19</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">../../make/linux</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
|
||||
@@ -22,19 +22,7 @@ VertexBufferVBO::VertexBufferVBO( const Uint32& vertexFlags, PrimitiveType drawT
|
||||
}
|
||||
|
||||
VertexBufferVBO::~VertexBufferVBO() {
|
||||
for ( Int32 i = 0; i < VERTEX_FLAGS_COUNT; i++ ) {
|
||||
if ( VERTEX_FLAG_QUERY( mVertexFlags, i ) && mArrayHandle[i] ) {
|
||||
glDeleteBuffersARB( 1, (unsigned int*)&mArrayHandle[i] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_USE_INDICES ) && mElementHandle ) {
|
||||
glDeleteBuffersARB( 1, (unsigned int*)&mElementHandle );
|
||||
}
|
||||
|
||||
if ( GLv_3CP == GLi->version() && mVAO ) {
|
||||
GLi->deleteVertexArrays( 1, &mVAO );
|
||||
}
|
||||
clear();
|
||||
}
|
||||
|
||||
void VertexBufferVBO::bind() {
|
||||
@@ -424,6 +412,21 @@ void VertexBufferVBO::unbind() {
|
||||
void VertexBufferVBO::clear() {
|
||||
mCompiled = false;
|
||||
mBuffersSet = false;
|
||||
|
||||
for ( Int32 i = 0; i < VERTEX_FLAGS_COUNT; i++ ) {
|
||||
if ( VERTEX_FLAG_QUERY( mVertexFlags, i ) && mArrayHandle[i] ) {
|
||||
glDeleteBuffersARB( 1, (unsigned int*)&mArrayHandle[i] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_USE_INDICES ) && mElementHandle ) {
|
||||
glDeleteBuffersARB( 1, (unsigned int*)&mElementHandle );
|
||||
}
|
||||
|
||||
if ( GLv_3CP == GLi->version() && mVAO ) {
|
||||
GLi->deleteVertexArrays( 1, &mVAO );
|
||||
}
|
||||
|
||||
VertexBuffer::clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -142,15 +142,15 @@ EE_MAIN_FUNC int main( int, char** ) {
|
||||
updateModel( true, false );
|
||||
filterView->setText( "" );
|
||||
} );
|
||||
const auto getSelectedPersonIt = [&]() -> std::vector<Person>::iterator {
|
||||
auto p = static_cast<PeopleModel*>( listView->getModel() )
|
||||
->getPerson( listView->getSelection().first() );
|
||||
auto found = std::find_if( people.begin(), people.end(),
|
||||
[&p]( const Person& person ) { return p.id == person.id; } );
|
||||
return found;
|
||||
};
|
||||
updateBut->onClick( [&]( auto ) {
|
||||
auto selPerson = static_cast<PeopleModel*>( listView->getModel() )
|
||||
->getPerson( listView->getSelection().first() );
|
||||
|
||||
auto found =
|
||||
std::find_if( people.begin(), people.end(), [&selPerson]( const Person& person ) {
|
||||
return selPerson.id == person.id;
|
||||
} );
|
||||
|
||||
auto found = getSelectedPersonIt();
|
||||
if ( found != people.end() ) {
|
||||
found->name = nameView->getText().toUtf8();
|
||||
found->surname = surnameView->getText().toUtf8();
|
||||
@@ -163,14 +163,7 @@ EE_MAIN_FUNC int main( int, char** ) {
|
||||
UIMessageBox::New( UIMessageBox::OK, "Select a person from the list" )->showWhenReady();
|
||||
return;
|
||||
}
|
||||
auto selPerson = static_cast<PeopleModel*>( listView->getModel() )
|
||||
->getPerson( listView->getSelection().first() );
|
||||
|
||||
auto found =
|
||||
std::find_if( people.begin(), people.end(), [&selPerson]( const Person& person ) {
|
||||
return selPerson.id == person.id;
|
||||
} );
|
||||
|
||||
auto found = getSelectedPersonIt();
|
||||
if ( found != people.end() ) {
|
||||
people.erase( found );
|
||||
clearInputs();
|
||||
|
||||
@@ -225,6 +225,8 @@ class TerminalEmulator final {
|
||||
|
||||
void setAllowMemoryTrimnming( bool allowMemoryTrimnming );
|
||||
|
||||
Vector2i getSize() const;
|
||||
|
||||
private:
|
||||
DpyPtr mDpy;
|
||||
PtyPtr mPty;
|
||||
|
||||
@@ -1236,8 +1236,8 @@ void TerminalDisplay::drawGrid( const Vector2f& pos ) {
|
||||
if ( mVBForeground )
|
||||
mVBForeground->setQuadColor( mCurGridPos, Color::Transparent );
|
||||
} else {
|
||||
auto* gd = mFont->getGlyphDrawable( glyph.u, mFontSize, glyph.mode & ATTR_BOLD, glyph.mode & ATTR_ITALIC, 0,
|
||||
advanceX );
|
||||
auto* gd = mFont->getGlyphDrawable( glyph.u, mFontSize, glyph.mode & ATTR_BOLD,
|
||||
glyph.mode & ATTR_ITALIC, 0, advanceX );
|
||||
|
||||
if ( ( glyph.mode & ATTR_EMOJI ) && FontManager::instance()->getColorEmojiFont() ) {
|
||||
gd->setColor( Color::White );
|
||||
@@ -1435,6 +1435,15 @@ Vector2i TerminalDisplay::positionToGrid( const Vector2i& pos ) {
|
||||
mouseY = eeclamp( (int)std::floor( relPos.y / fontSize ), 0, clipRows - 1 );
|
||||
}
|
||||
|
||||
// All these checks are because there's a very rare bug I cannot find how it happens
|
||||
auto termSize = mTerminal->getSize();
|
||||
|
||||
eeASSERT( mouseX >= 0 && mouseX <= mTerminal->getSize().x );
|
||||
eeASSERT( mouseY >= 0 && mouseY <= mTerminal->getSize().y );
|
||||
|
||||
mouseX = eeclamp( mouseX, 0, termSize.x );
|
||||
mouseY = eeclamp( mouseY, 0, termSize.y );
|
||||
|
||||
return { mouseX, mouseY };
|
||||
}
|
||||
|
||||
|
||||
@@ -734,6 +734,10 @@ void TerminalEmulator::setAllowMemoryTrimnming( bool allowMemoryTrimnming ) {
|
||||
mAllowMemoryTrimnming = allowMemoryTrimnming;
|
||||
}
|
||||
|
||||
Vector2i TerminalEmulator::getSize() const {
|
||||
return { mTerm.col, mTerm.row };
|
||||
}
|
||||
|
||||
bool TerminalEmulator::isScrolling() const {
|
||||
return mTerm.scr != 0;
|
||||
}
|
||||
|
||||
@@ -117,6 +117,8 @@ void IconManager::init( UISceneNode* sceneNode, FontTrueType* iconFont, FontTrue
|
||||
{ "filetype-rb", 61880 },
|
||||
{ "filetype-rs", 61881 },
|
||||
{ "filetype-ts", 61923 },
|
||||
{ "filetype-jsx", 0xf1ab },
|
||||
{ "filetype-tsx", 0xf1ab },
|
||||
{ "filetype-yaml", 61945 },
|
||||
{ "filetype-yml", 61945 },
|
||||
{ "filetype-jpg", 61801 },
|
||||
@@ -139,9 +141,10 @@ void IconManager::init( UISceneNode* sceneNode, FontTrueType* iconFont, FontTrue
|
||||
{ "filetype-nim", 61734 },
|
||||
{ "filetype-xml", 61769 },
|
||||
{ "filetype-dockerfile", 61758 },
|
||||
{ "filetype-ruby", 61880 },
|
||||
{ "filetype-scala", 61882 },
|
||||
{ "filetype-sc", 61882 },
|
||||
{ "filetype-perl", 61853 },
|
||||
{ "filetype-vue", 0xf1f4 },
|
||||
{ "file", 61766 },
|
||||
{ "file-symlink", 61774 },
|
||||
{ "folder", 0xF23B },
|
||||
|
||||
@@ -27,13 +27,14 @@ static size_t countLines( const std::string& text ) {
|
||||
}
|
||||
|
||||
static void readAllLines( const std::string_view& buf,
|
||||
std::function<void( const std::string_view& )> onLineRead ) {
|
||||
std::function<void( const std::string_view& )> onLineRead,
|
||||
char sep = '\n' ) {
|
||||
auto lastNL = 0;
|
||||
auto nextNL = buf.find_first_of( '\n' );
|
||||
auto nextNL = buf.find_first_of( sep );
|
||||
while ( nextNL != std::string_view::npos ) {
|
||||
onLineRead( buf.substr( lastNL, nextNL - lastNL ) );
|
||||
lastNL = nextNL + 1;
|
||||
nextNL = buf.find_first_of( '\n', nextNL + 1 );
|
||||
nextNL = buf.find_first_of( sep, nextNL + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +597,14 @@ Git::Status Git::status( bool recurseSubmodules, const std::string& projectDir )
|
||||
bool isStagedAndModified =
|
||||
status.type == GitStatusType::Staged && statusStr[1] != ' ';
|
||||
|
||||
auto filePath = subModulePath + file;
|
||||
if ( status.symbol == GitStatusChar::Renamed ) {
|
||||
LuaPattern rpattern( ".*%s%-%>%s(.*)" );
|
||||
LuaPattern::Range rranges[2];
|
||||
if ( rpattern.matches( file.data(), 0, rranges, file.size() ) )
|
||||
file = file.substr( rranges[1].start, rranges[1].end - rranges[1].start );
|
||||
}
|
||||
|
||||
std::string filePath = subModulePath + file;
|
||||
auto repo = repoName( filePath, false, projectDir );
|
||||
auto repoIt = s.files.find( repo );
|
||||
bool found = false;
|
||||
@@ -644,11 +652,18 @@ Git::Status Git::status( bool recurseSubmodules, const std::string& projectDir )
|
||||
} else if ( pattern.matches( line.data(), 0, matches, line.size() ) ) {
|
||||
auto inserted = line.substr( matches[1].start, matches[1].end - matches[1].start );
|
||||
auto deleted = line.substr( matches[2].start, matches[2].end - matches[2].start );
|
||||
auto file = line.substr( matches[3].start, matches[3].end - matches[3].start );
|
||||
std::string file = std::string{
|
||||
line.substr( matches[3].start, matches[3].end - matches[3].start ) };
|
||||
int inserts;
|
||||
int deletes;
|
||||
if ( String::fromString( inserts, inserted ) &&
|
||||
String::fromString( deletes, deleted ) && ( inserts || deletes ) ) {
|
||||
LuaPattern pattern( "(.*)%{.*%s->%s(.*)%}" );
|
||||
if ( pattern.matches( file.data(), 0, matches, file.size() ) ) {
|
||||
file = file.substr( matches[1].start, matches[1].end - matches[1].start ) +
|
||||
file.substr( matches[2].start, matches[2].end - matches[2].start );
|
||||
}
|
||||
|
||||
auto filePath = subModulePath + file;
|
||||
auto repo = repoName( filePath, false, projectDir );
|
||||
auto repoIt = s.files.find( repo );
|
||||
|
||||
Reference in New Issue
Block a user