(release_30)bugFix: fix loading of packagage/modules#360
Merged
SlySven merged 1 commit intoMudlet:release_30from Dec 11, 2016
Conversation
This is an amalgumation of a series of commits previously applied to the development branch: Cleanup: clear dead code & prevent reentrancy issue in Host::installPackage --------------------------------------------------------------------------- Host::installPackage(...) can call Host::uninstallPackage(...) which in turn can call Host::installPackage(...) back. This reentrancy could cause issues with a single instance of a QDialog used by the former which was accessed via a class member pointer. The previous code structure avoids this, but if the code failed to maintain the case where this is safe (when second argument has the value of 2) there would be multiple QDialogs created but only one could be tracked by a class member pointer. It is possible to avoid this issue by using a method local pointer which is enough in the new code which only uses the pointer in this method. The previous (void)Host::showUnpackingProgress(QString) was rendered ineffective with an immediate return statement. As such it was dead code and removing it also negated the reason for (void) mudlet::showUnzipProgress(const QString&) so that (int) TLuaInterpreter::showUnzipProgress(lua_State*) is also dead code. To avoid any breakage that has been converted into a stub that just reports via a nil + error message that it is such a stub and can be safely removed from scripts. Finally, the QDialog mentioned above was not being removed when Host::installPackage(...) failed with an error. This gave the effect of Mudlet hanging when package/module installation failed. Note that we are STILL woefully short of error messages in this process but that needs to be the subject of further commits. Refactor: remove more dead/ineffective code from Host and dlgTriggerEditor --------------------------------------------------------------------------- The (bool)Host::serialize() method was short-circuited with an initial "return false;" and it was only called in: (void) dlgTriggerEditor::slot_save_edit() which did not rely on the return value. Further examination of the latter method also revealed that all of the dlgTriggerEditor::slot_saveXXXXAfterEdit() calls it used were just wrappers around the corresponding dlgTriggerEditor::saveXXX() methods and there was no other use of the "public slots:" wrappers so they can be safely eliminated. BugFix: scan for and create needed directories when installing packages --------------------------------------------------------------------------- Some file archiving production systems do not seem to be inserting the (zero length) entries with names ending in a '/' for sub-directories in archive files. This commit now makes two passes through any package or module and identifies all directories that will be needed, it then makes them before it extracts the files to populate those directories. This should fix https://bugs.launchpad.net/mudlet/+bug/1413069 as it also ensures that the proper cleaning process is done should package installation fail, it removes the "Unpacking" dialog on failure which was not happening before. NOTE: There is still an extreme lack of error reporting but as Host::installPackage(...) is used in several places by different parts of the application that is probably addressed separately. Also: * wrapped strings in Host::installPackage(...) in QStringLiteral(...) or tr(...) wrappers and made it more likely to be Utf8 clean. * Increased the size of the buffer used during extraction of possibly compressed archived package files from 100 to 4096 bytes which means less loops will be needed to process such archived files. * Ensured path / file name manipulations/test are not Case Sensitive so that they will not misbehave on MacOS platforms. * Tweaked displaying of the "Unpacking package/module..." dialog so that it shows more consistently (it often hid under other windows on my GNU/Linux setup!) Tweak: Try to ensure "Unpacking package/module" message is shown correctly --------------------------------------------------------------------------- I did not detect the dialog being put up but not being properly painted on my Linux box but Vadim did produce a screen capture video showing how the "Unpacking ..." message was being put up on top of the Mudlet application but the box, although the frame was displayed did not have it's internal contents filled in. It was not clear which OS platform he got this on and I did wonder whether it might have been a Mac which might have different GUI systems to my Linux one, but this commit ensures that a repaint() is used before a qApp->processEvents() call which should mean the widget is properly filled out... In fact this still doesn't work for some Linux systems but the reasons are still not clear! Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
mehulmathur16
pushed a commit
to mehulmathur16/Mudlet
that referenced
this pull request
Feb 16, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an amalgumation of a series of commits previously applied to the
development branch:
Cleanup: clear dead code & prevent reentrancy issue in Host::installPackage
Host::installPackage(...)can callHost::uninstallPackage(...)which inturn can call
Host::installPackage(...)back. This reentrancy could causeissues with a single instance of a
QDialogused by the former which wasaccessed via a class member pointer. The previous code structure avoids
this, but if the code failed to maintain the case where this is safe (when
second argument has the value of 2) there would be multiple
QDialogscreated but only one could be tracked by a class member pointer. It is
possible to avoid this issue by using a method local pointer which is
enough in the new code which only uses the pointer in this method.
The previous
(void)Host::showUnpackingProgress(QString)was renderedineffective with an immediate return statement. As such it was dead code
and removing it also negated the reason for
(void) mudlet::showUnzipProgress(const QString&)so that(int) TLuaInterpreter::showUnzipProgress(lua_State*)is also dead code.To avoid any breakage that has been converted into a stub that just reports
via a nil + error message that it is such a stub and can be safely removed
from scripts.
Finally, the
QDialogmentioned above was not being removed whenHost::installPackage(...)failed with an error. This gave the effect ofMudlet hanging when package/module installation failed. Note that we are
STILL woefully short of error messages in this process but that needs to
be the subject of further commits.
Refactor: remove more dead/ineffective code from Host and dlgTriggerEditor
The
(bool)Host::serialize()method was short-circuited with an initialreturn false;and it was only called in:(void) dlgTriggerEditor::slot_save_edit()which did not rely on the returnvalue. Further examination of the latter method also revealed that all
of the
dlgTriggerEditor::slot_saveXXXXAfterEdit()calls it used were justwrappers around the corresponding
dlgTriggerEditor::saveXXX()methods andthere was no other use of the
public slots:wrappers so they can besafely eliminated.
BugFix: scan for and create needed directories when installing packages
Some file archiving production systems do not seem to be inserting the
(zero length) entries with names ending in a
'/'for sub-directories inarchive files. This commit now makes two passes through any package or
module and identifies all directories that will be needed, it then makes
them before it extracts the files to populate those directories.
This should fix https://bugs.launchpad.net/mudlet/+bug/1413069 as it also
ensures that the proper cleaning process is done should package
installation fail, it removes the "Unpacking" dialog on failure which was
not happening before.
NOTE: There is still an extreme lack of error reporting but as
Host::installPackage(...)is used in several places by different parts ofthe application that is probably addressed separately.
Also:
Host::installPackage(...)inQStringLiteral(...)ortr(...)wrappers and made it more likely to be Utf8 clean.compressed archived package files from 100 to 4096 bytes which means
less loops will be needed to process such archived files.
that they will not misbehave on MacOS platforms.
it shows more consistently (it often hid under other windows on my
GNU/Linux setup!)
Tweak: Try to ensure "Unpacking package/module" message is shown correctly
I did not detect the dialog being put up but not being properly painted on
my Linux box but Vadim did produce a screen capture video showing how the
"Unpacking ..." message was being put up on top of the Mudlet application
but the box, although the frame was displayed did not have it's internal
contents filled in. It was not clear which OS platform he got this on and
I did wonder whether it might have been a Mac which might have different
GUI systems to my Linux one, but this commit ensures that a
repaint()isused before a
qApp->processEvents()call which should mean the widget isproperly filled out...
In fact this still doesn't work for some Linux systems but the reasons are
still not clear!
This is the same as the series of commits that were #345 for the development branch.
Signed-off-by: Stephen Lyons slysven@virginmedia.com