| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Use GLib.str_hash until Regress has a suitable test case.
|
|
|
|
| |
The arg-cache marshaller for null (pointers) doesn't check if the argument is nullable. This is a regression introduced by the arg-cache that can cause segfaults in functions such as GLib.str_hash.
|
|\
| |
| |
| |
| | |
Trampoline cleanups
See merge request GNOME/gjs!491
|
| |
| |
| |
| |
| |
| |
| |
| | |
Move the inner part, after which we have to handle callback errors, into a
separate function so that we can return early and remove the old-style
goto code.
(Philip Chimento: refactored, based on review comments)
|
| |
| |
| |
| |
| |
| |
| | |
Make the struct a bit smarter, including auto pointers and methods to
access to the internal values.
Still manage the object creation and reference counting externally.
|
| |
| |
| |
| |
| | |
Most of them are just acces operators, so we can mark it clearer to the
compiler.
|
| |
| |
| |
| |
| | |
Other than being more c++ style, it allows us to handle cleanups
automatically.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In arg-cache we add a new reference to the trampoline that is going to
be removed on DestroyNotify callback or(?) when the async calls are
cleared. However this is quite unclear as it picks multiple types of
function scopes.
So put all together adding a ref and using a lambda function to unref,
so that we have a more readable and understandable code.
This fixes also a potential issue when a function is both async and has
a callback destroy, as in such case we'd just add one reference, while
we'd remove two.
|
| |
| |
| |
| |
| |
| | |
Instead of cleaning up the async trampolines we've left around at very
next function call, let's do it when next garbage collection cycle is
performed.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
Since we depend on GLib 2.58 that includes this, let's just use it
|
|/
|
|
|
| |
This mimics GOBject and other GLib structs, and can be useful with
auto-pointers.
|
|\
| |
| |
| |
| | |
CI: Fix IWYU includes
See merge request GNOME/gjs!501
|
|/ |
|
|\
| |
| |
| |
| | |
profiler: Support external SysprofCaptureWriters
See merge request GNOME/gjs!489
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Using environment variables to control the profiler is limiting,
and when it comes to GNOME Shell, it adds an extra level of
complexity, since it forces us to start GNOME Shell with the
right environment set.
Add support for setting a caller-controlled SysprofCaptureWriter.
The header file treats it as a gpointer to avoid including config.h.
If an external capture writer is set, it takes precedence over the
filename and the file descriptor.
|
|\ \
| | |
| | |
| | |
| | | |
Add GIArgument wrapper tests
See merge request GNOME/gjs!493
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Ensure that gjs_arg_set, gjs_arg_get and gjs_arg_unset work as expected
using random numbers that are generated per type and using some template
functions to do smarter comparisions.
Expose the random sed we used to generate the random numbers and
generate the c++ one using a random number generated from g_test so that
it will be consistent with `--seed` or in general with the GLib seed.
Add support for a `--cpp-seed` option to be able to pass it one manually
|
|\ \
| |/
|/|
| |
| | |
Replace long ifs with switch/cases
See merge request GNOME/gjs!497
|
| |
| |
| |
| | |
Avoid using multiple if checks when a switch can just use direct access
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Strings are used enough that even a micro-optimization like this could
save something
|
|\ \
| | |
| | |
| | |
| | | |
console: fix typo in command-line option
See merge request GNOME/gjs!500
|
|/ /
| |
| |
| |
| | |
Help for `--coverage-output` refers to `--coverage-path` instead of
`--coverage-prefix`.
|
|\ \
| |/
|/|
| |
| |
| |
| | |
gjs: fix build with clang
Closes #347
See merge request GNOME/gjs!499
|
| |
| |
| |
| | |
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
|
| | |
|
|/ |
|
|\
| |
| |
| |
| | |
Fix leak when virtual function is unimplemented.
See merge request GNOME/gjs!498
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
arg: Fix MIN/MAX safe big integer limits
See merge request GNOME/gjs!492
|
| |/
| |
| |
| |
| |
| |
| |
| |
| | |
Current JS Number's MAX_SAFE_INTEGER value is set to 9007199254740991,
however we set this value to 9007199254740992.
Fix the number computation and add an unit test to ensure that the value
we use is always matching JS definition (so that we are protected in the
unlikely case that anything would change).
|
|\ \
| | |
| | |
| | |
| | | |
cleanup: Don't use GSlice anywhere
See merge request GNOME/gjs!488
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
GSlice API is going to be deprecated [1] and marked as such for some
years now, even if this change didn't happen yet, there's no point to
keep GSlice usage in gjs, considering that we can semplificate it with
calls to system allocator using g_new/g_malloc and g_free.
Once I applied this change, I've noticed that the memory sanitzer found
some leaks in the trampoline code that for some reason GSlice was hiding
and that this commit underlines.
[1] https://gitlab.gnome.org/GNOME/glib/-/issues/1079
|
| | |
| | |
| | |
| | |
| | | |
It can be useful to be used as replacement of g_steal_pointer with
appropriate casting for type
|
|\ \ \
| |_|/
|/| |
| | |
| | | |
Throws on Unsupported caller allocates (and add tests for #344)
See merge request GNOME/gjs!495
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is a test for issue [1], even though the actual test would be
veryfing that the function correctly works, this is not yet supported as
per issue [2] and so for now it's just better to check that the behavior
previous to the arg-cache is preserved.
[1] https://gitlab.gnome.org/GNOME/gjs/-/issues/344
[2] https://gitlab.gnome.org/GNOME/gjs/-/issues/106
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previous of commit aa28329b7 we were assuming that all the
caller-allocates function were using an interface tag, that was wrong
but at the same time we don't yet support any other type of
caller-allocats function yet [1], so if we detect one type that we don't
support we should just throw with some valuable error as we used to do and
not just crash.
Otherwise it would be impossible to test a solution for bug [2].
[1] https://gitlab.gnome.org/GNOME/gjs/-/issues/106
[2] https://gitlab.gnome.org/GNOME/gjs/-/issues/344
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In case the function initialization fails for some reason, we only need
the info function to be set in case we have defined arguments, otherwise
we might have just failed at the early stages of the cache-init function
and nor the GI info or the arguments are set.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If we throw during the arguments cache creation as we fail during an early
stage of init_cached_function_data, we don't save the function GICallableInfo
or the already allocated parameters, but we'd just return loosing
track of allocated data.
This is not just a potential leak, but also wrong as if a method
introspection is malformed or not fully supported by gjs, we'd just
assert crashing badly during function unallocation because no function
info is set, instead of just throwing as expected.
As per this, let's save the function private informations (such as the
callable info and the arguments cache) as soon as we allocate them,
and update the number of initialized arguments in real time, so that
we can partially de-allocate the arguments cache in case of errors.
This also implies that during function de-init we must ensure that
we don't overflow using the marshallers pointer to check if we've ever
initialized such argument cache and to figure out how many we've allocated
other than of the total number of the introspected function arguments.
|
| | |
|
| | |
|
|\ \
| |/
|/|
| |
| |
| |
| | |
arg-cache: Don't assume an interface type on caller allocates
Closes #344
See merge request GNOME/gjs!486
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When we get an out parameter with caller-allocates flag we assume that
it's an interface, but this may not be the case like for array out
parameters.
As per this, verify that the type tag matches the interface even when
we've a caller allocates argument.
Closes: https://gitlab.gnome.org/GNOME/gjs/-/issues/344
|
|\ \
| | |
| | |
| | |
| | | |
August maintenance
See merge request GNOME/gjs!485
|