Remember me

Lost Password?

Register now!


Who's Online
98 user(s) are online (85 user(s) are browsing Forums)

Members: 2
Guests: 96

m3x, Skateman, more...

Support us!


Report message:*

Re: Odyssey 1.23 progress

Subject: Re: Odyssey 1.23 progress
by Hans on 2020/3/2 8:50:34


Spotted a problem in Source/WebKit/OrigynWebBrowser/Api/WebPreferences.cpp:

const charWebPreferences::stringValueForKey(const charkey)
string value m_privatePrefs[key];

This creates a temporary copy of the string object, and then returns a pointer to its internal C string. Unfortunately, the temporary copy gets destroyed when the method returns, leaving the pointer hanging. You've been "lucky" that it happened to work with older compilers.

I haven't tried it yet, but the following should work:
const charWebPreferences::stringValueForKey(const charkey)
string &value m_privatePrefs[key];

Note the & in front of the value. That turns the variable into a reference that points to the original string, which won't disappear the moment the method returns.

EDIT: Looks like that same mistake was done multiple times in the same file...


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project