summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add test for not-nullable gpointer parameters.ewlsh/fix-null-pointersEvan Welsh2020-10-011-0/+8
| | | | Use GLib.str_hash until Regress has a suitable test case.
* Prevent passing null pointers when not nullable.Evan Welsh2020-10-011-3/+2
| | | | 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.
* Merge branch 'trampoline-cleanups' into 'master'Philip Chimento2020-09-207-255/+283
|\ | | | | | | | | Trampoline cleanups See merge request GNOME/gjs!491
| * function: Split trampoline callback handler removing gotoMarco Trevisan (Treviño)2020-09-202-95/+108
| | | | | | | | | | | | | | | | 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)
| * function: Use c++ features to handle GjsCallbackTrampolineMarco Trevisan (Treviño)2020-09-204-108/+137
| | | | | | | | | | | | | | 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.
| * jsapi-util: Mark some GjsAutoPointer operations as constexprMarco Trevisan (Treviño)2020-09-201-4/+6
| | | | | | | | | | Most of them are just acces operators, so we can mark it clearer to the compiler.
| * function: Use a vector to hold the completed trampolinesMarco Trevisan (Treviño)2020-09-202-7/+5
| | | | | | | | | | Other than being more c++ style, it allows us to handle cleanups automatically.
| * arg-cache: Make it clearer how we handle the trampoline referencesMarco Trevisan (Treviño)2020-09-202-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * engine: Cleanup leftover async calls trampolines on gcMarco Trevisan (Treviño)2020-09-203-9/+5
| | | | | | | | | | | | 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.
| * function: Use more auto pointers for base infoMarco Trevisan (Treviño)2020-09-201-8/+3
| |
| * function: Cleanup the completed trampolines removal in one callMarco Trevisan (Treviño)2020-09-201-8/+3
| |
| * function: Define a trampoline autopointer cleanup function and use itMarco Trevisan (Treviño)2020-09-203-14/+13
| |
| * function: Use gatomicrefcount for trampoline refcountingMarco Trevisan (Treviño)2020-09-202-7/+5
| | | | | | | | Since we depend on GLib 2.58 that includes this, let's just use it
| * function: Make gjs_callback_trampoline_ref to return the structMarco Trevisan (Treviño)2020-09-202-4/+5
|/ | | | | This mimics GOBject and other GLib structs, and can be useful with auto-pointers.
* Merge branch 'includes' into 'master'Philip Chimento2020-09-2011-9/+8
|\ | | | | | | | | CI: Fix IWYU includes See merge request GNOME/gjs!501
| * CI: Fix IWYU includesincludesPhilip Chimento2020-09-2011-9/+8
|/
* Merge branch 'gbsneto/external-capture-writer' into 'master'Philip Chimento2020-09-202-1/+33
|\ | | | | | | | | profiler: Support external SysprofCaptureWriters See merge request GNOME/gjs!489
| * profiler: Support external SysprofCaptureWritersgbsneto/external-capture-writerGeorges Basile Stavracas Neto2020-09-192-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'args-tests' into 'master'Philip Chimento2020-09-201-1/+210
|\ \ | | | | | | | | | | | | Add GIArgument wrapper tests See merge request GNOME/gjs!493
| * | gjs-tests: Add tests to verify rounded GArgument getterMarco Trevisan (Treviño)2020-09-191-0/+33
| | |
| * | gjs-tests: Add gjs_arg_* testsMarco Trevisan (Treviño)2020-09-191-1/+177
|/ / | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge branch 'more-switches' into 'master'Philip Chimento2020-09-194-167/+208
|\ \ | |/ |/| | | | | Replace long ifs with switch/cases See merge request GNOME/gjs!497
| * arg: Use switch/cases instead of long if's when convenientMarco Trevisan (Treviño)2020-09-191-111/+128
| | | | | | | | Avoid using multiple if checks when a switch can just use direct access
| * object: Use switch to introspection unsupported tagsMarco Trevisan (Treviño)2020-09-191-10/+17
| |
| * jsapi-util-error: Use switch to filter the supported error protosMarco Trevisan (Treviño)2020-09-191-5/+14
| |
| * arg-cache: Use switch to select the array length argument typeMarco Trevisan (Treviño)2020-09-191-17/+20
| |
| * arg: Use a switch to check the intarray element tagsMarco Trevisan (Treviño)2020-09-191-24/+29
| | | | | | | | | | Strings are used enough that even a micro-optimization like this could save something
* | Merge branch 'fix-cli-help-message' into 'master'Philip Chimento2020-09-191-1/+1
|\ \ | | | | | | | | | | | | console: fix typo in command-line option See merge request GNOME/gjs!500
| * | console: fix typo in command-line optionAndy Holmes2020-09-181-1/+1
|/ / | | | | | | | | Help for `--coverage-output` refers to `--coverage-path` instead of `--coverage-prefix`.
* | Merge branch 'clang' into 'master'Philip Chimento2020-09-182-3/+3
|\ \ | |/ |/| | | | | | | | | gjs: fix build with clang Closes #347 See merge request GNOME/gjs!499
| * fix build with clangMarc-Antoine Perennou2020-09-172-3/+3
| | | | | | | | Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
* | build: Post-branch version bumpPhilip Chimento2020-09-121-1/+1
| |
* | release: Add NEWS from stable release 1.66.0Philip Chimento2020-09-121-0/+5
|/
* Merge branch 'ewlsh/fix-leak' into 'master'Philip Chimento2020-09-101-0/+1
|\ | | | | | | | | Fix leak when virtual function is unimplemented. See merge request GNOME/gjs!498
| * Fix leak when virtual function is unimplemented.Evan Welsh2020-09-081-0/+1
| |
* | Merge branch 'safe-integers-check' into 'master'Philip Chimento2020-09-102-2/+34
|\ \ | | | | | | | | | | | | arg: Fix MIN/MAX safe big integer limits See merge request GNOME/gjs!492
| * | arg: Fix MIN/MAX safe big integer limitsMarco Trevisan (Treviño)2020-09-072-2/+34
| |/ | | | | | | | | | | | | | | | | 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).
* | Merge branch 'remove-gslice' into 'master'Philip Chimento2020-09-109-29/+34
|\ \ | | | | | | | | | | | | cleanup: Don't use GSlice anywhere See merge request GNOME/gjs!488
| * | cleanup: Don't use GSlice anywhereMarco Trevisan (Treviño)2020-09-047-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | arg-inl: Add gjs_arg_steal to unset a value and return its valueMarco Trevisan (Treviño)2020-09-043-9/+13
| | | | | | | | | | | | | | | It can be useful to be used as replacement of g_steal_pointer with appropriate casting for type
* | | Merge branch 'unsupported-caller-allocates-throws' into 'master'Philip Chimento2020-09-103-21/+39
|\ \ \ | |_|/ |/| | | | | | | | Throws on Unsupported caller allocates (and add tests for #344) See merge request GNOME/gjs!495
| * | testGIMarshalling: Introspecting an unsupported out-caller allocated throwsMarco Trevisan (Treviño)2020-09-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | arg-cache: Throw an error when handling unsupported caller-allocates typesMarco Trevisan (Treviño)2020-09-101-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | function: Assert the presency of function info only if we've argumentsMarco Trevisan (Treviño)2020-09-101-4/+4
| | | | | | | | | | | | | | | | | | | | | 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.
| * | function: Early-initialize arguments cache or we won't ever release themMarco Trevisan (Treviño)2020-09-101-15/+18
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | build: Post-release version bumpPhilip Chimento2020-09-051-1/+1
| |
* | release: Prepare for 1.65.921.65.92Philip Chimento2020-09-051-0/+17
| |
* | Merge branch 'arg-cache-dont-assume-interface' into 'master'Philip Chimento2020-09-051-2/+3
|\ \ | |/ |/| | | | | | | | | arg-cache: Don't assume an interface type on caller allocates Closes #344 See merge request GNOME/gjs!486
| * arg-cache: Don't assume an interface type on caller allocatesMarco Trevisan (Treviño)2020-09-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | 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
* | Merge branch 'august-maintenance' into 'master'Philip Chimento2020-09-036-5/+47
|\ \ | | | | | | | | | | | | August maintenance See merge request GNOME/gjs!485