Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fullpipe Common::String + memory leak fixes #925

Merged
merged 15 commits into from Mar 23, 2017
Merged

Conversation

@bluegr
Copy link
Member

bluegr commented Mar 22, 2017

In this pull request, I've changed a lot of engine strings in Fullpipe so that they are handled via Common::String. This results in cleaner and more manageable code.

I've tried splitting up the commits so that all relevant changes are grouped together

Update: I've also added some memory leak fixes to this branch, as part of fixing memory leaks in this engine. These are relevant, because the original intention of this branch was to optimize code and identify memory leaks.

@@ -221,10 +210,10 @@ bool Scene::load(MfcArchive &file) {

_libHandle = g_fp->_currArchive;

if (_picObjList.size() > 0 && _bgname && strlen(_bgname) > 1) {
if (_picObjList.size() > 0 && _bgname.size() > 1) {

This comment has been minimized.

Copy link
@sev-

sev- Mar 22, 2017

Member

!_bgname.empty()

This comment has been minimized.

Copy link
@bluegr

bluegr Mar 22, 2017

Author Member

Fixed in af874d4

bluegr added 6 commits Mar 22, 2017
Checking for an empty string is what the original code does, according
to sev, so the check for a string of size 1 was wrong
_bitmap is initialized with new, so it needs to be freed with delete,
not free()
The TODO in the code in question should be reviewed, but the call to
freePixelData() unconditionally deleted the original bitmap, which is
not correct
Free the pixel data of each entry in the _dynamicPhases array before
emptying it
@bluegr bluegr changed the title Fullpipe Common::String Fullpipe Common::String + memory leak fixes Mar 22, 2017
@sev-
Copy link
Member

sev- commented Mar 23, 2017

Sweet.

@sev- sev- merged commit db4979f into scummvm:master Mar 23, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@wjp
Copy link
Member

wjp commented Mar 23, 2017

Looks good, but I don't understand why the Common::String function arguments are a mix of by-value and by-(non-const-)reference, instead of the standard const Common::String &.

@bluegr
Copy link
Member Author

bluegr commented Mar 23, 2017

Good point @wjp. I'll adapt these accordingly on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.