From 154c0c5cb14c1b2572194c7afb566f9851e450fd Mon Sep 17 00:00:00 2001 From: Gabor de Mooij Date: Sun, 17 Dec 2023 16:02:59 +0100 Subject: [PATCH] Fix crash upon replacing text from clipboard. --- misc/distrib_win64.sh | 12 ++++++++++-- plugins/media/media.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/misc/distrib_win64.sh b/misc/distrib_win64.sh index c59a90ccc..7302635aa 100755 --- a/misc/distrib_win64.sh +++ b/misc/distrib_win64.sh @@ -19,7 +19,7 @@ mkdir dist/Linux/ISO mkdir dist/Linux/OUT -declare -a langs=("nl" "ru" "en" "hi" "fr" "no" "pt_br" "uz" "pl" "cs" "id") +declare -a langs=("nl" "en") for lang in "${langs[@]}" do @@ -102,8 +102,16 @@ cp bin/Linux/ctr$lang dist/Linux/ISO/$lang/ cp plugins/media/libctrmedia.so dist/Linux/ISO/$lang/mods/media/ rm dist/Linux/ISO/$lang/*.dll sed -e "s/ctrnl/ctr$lang/g" plugins/media/assets/citrine.sh > dist/Linux/ISO/$lang/citrine.sh +sed -e "s/ctrnl/ctrapp_$lang/g" plugins/media/assets/citrine.sh > dist/Linux/ISO/$lang/citrine_app.sh chmod uog+x dist/Linux/ISO/$lang/citrine.sh +chmod uog+x dist/Linux/ISO/$lang/citrine_app.sh -tar cvzf "dist/Linux/OUT/$lang/citrine${lang}096.tar.gz" -C dist/Linux/ISO/$lang/ . +# Create Linux AppImage distribution +rm -rf /tmp/Citrine.AppDir +cp -r misc/Citrine.AppDir /tmp/ +cp dist/Linux/ISO/${lang}/ctr${lang} /tmp/Citrine.AppDir/ +./appimagetool-x86_64.AppImage /tmp/Citrine.AppDir citrine_app ; cp citrine_app dist/Linux/ISO/nl/ctrapp_${lang} +chmod uog+x dist/Linux/ISO/nl/ctrapp_${lang} +tar cvzf "dist/Linux/OUT/$lang/citrine${lang}096.tar.gz" -C dist/Linux/ISO/$lang/ . done \ No newline at end of file diff --git a/plugins/media/media.c b/plugins/media/media.c index 92b6a86e2..8b0085e56 100644 --- a/plugins/media/media.c +++ b/plugins/media/media.c @@ -468,7 +468,7 @@ void ctr_internal_media_textinsert(MediaIMG* mediaImage, char* text) { } mediaImage->textlength = mediaImage->textlength + insertTextLength; if (mediaImage->textlength+1 > mediaImage->textbuffer) { - mediaImage->textbuffer = (mediaImage->textbuffer) ? mediaImage->textbuffer * 2 : 1; + mediaImage->textbuffer = mediaImage->textlength + 500; mediaImage->text = ctr_heap_reallocate(mediaImage->text, mediaImage->textbuffer + 1); } memcpy(mediaImage->text+CtrMediaInputIndex+insertTextLength, mediaImage->text+CtrMediaInputIndex,mediaImage->textlength-CtrMediaInputIndex-insertTextLength);