stlab / adobe_source_libraries Goto Github PK
View Code? Open in Web Editor NEWAdobe Source Libraries
License: Boost Software License 1.0
Adobe Source Libraries
License: Boost Software License 1.0
https://github.com/stlab/adobe_source_libraries/blob/main/adobe/task.hpp
Missing include <string>
. Some header files included for windows and non-windows should be moved into the non-windows section.
Hello!
When exploring the use of adobe::capture_allocator
, I ran into an edge-case.
When creating a vector as such:
// An example object, who's only notable trait is the use of new/delete.
struct BoundryTest_t
{
BoundryTest_t()
{
p = new char[128];
}
~BoundryTest_t()
{
delete p;
}
char* p = NULLPTR;
};
// This function exists in another DLL (bar.dll), not the current DLL (foo.dll).
// Simply calls push_back with default constructor arguments a few times.
void MyFunction(std::vector<BoundryTest_t, adobe::capture_allocator<BoundryTest_t>>& vecTestObjects);
If I'm understanding this correctly - due to the object BoundryTest_t
invoking new
within the constructor, this causes a memory leak. When MyFunction in foo.dll allocates new instances of BoundryTestVec_t and the constructor is invoked, the construct_at
function is run inside the bar.dll. This results in heap corruption in the current foo.dll scope upon the occasion of foo.dll attempting to clean up the vector.
What is the expected workaround for this behavior?
Thank you for your time!
Acceptance Criteria
I'm interested in joining the slack channel
assemblage.hpp has assemblage_cleanup_connection
member function, which Xcode's Product > Analyze identifies as culpable for use after free, as called within TBindingBehavior<Widget, T>::IBindingBehavior
's in its adobe::attach_view_function_to_model<value_type>
call.
Unfortunately, this analysis is not easy to copy-and-paste. It's all presented as overlays in the Xcode code editor.
The "action item" here is to run ASL through Xcode's Product > Analyze (the Clang Static Analyzer).
Considering in an automated UI test, (only) a text entry is frequently updated, the priority_m of the backed cell is continuously increased(assigned from priority_high_m++), and will finally overflow.
Possible solutions are:
void sheet_t::implementation_t::flow(cell_bits_t& priority_accessed) {
...
sort(cells, less(), &cell_t::priority);
...
priority_high_m = priority_low_m = 0; // reset priority_high_m & priority_low_m
for (vector<cell_t*>::iterator f = cells.begin(), l = cells.end(); f != l; ++f) {
priority_accessed.set((*f)->interface_input_m->cell_set_pos_m);
// Vacuum "the priority sequence"
++priority_high_m;
(*f)->interface_input_m->priority_m = priority_high_m;
...
The Ideas will be:
{ link_node *prev; link_node *next; void *data }
For any_regular_t and similar types the following should be valid operations:
any_regular_t x = 10.5;
x = "Hello world!";
x == "Hello world!";
The issue occurs when call for build.sh.. I tried to disable std=c++11 but it is not happening
../boost_libraries/boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef' file not found
^~~~~~~~~
1 error generated.
"clang++" -c -x c++ -std=c++11 -fconstexpr-depth=1024 -ftemplate-depth=1024 -stdlib=libc++ -std=c++14 -O0 -g -fno-inline -Wall -g -pthread -std=c++11 -fconstexpr-depth=1024 -ftemplate-depth=1024 -stdlib=libc++ -std=c++14 -DADOBE_SERIALIZATION -DADOBE_STD_SERIALIZATION -DBOOST_ALL_NO_LIB -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_NO_CXX11_NUMERIC_LIMITS=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB -DBOOST_THREAD_USE_LIB=1 -I"." -I".." -I"../boost_libraries" -o "/home/nathbh/adobe/built_artifacts/fccaf884b85829048d264073f9341a53/source/string_pool.o" "source/string_pool.cpp"
I have a question on Stackoverflow describing the issue. The basic problem is that specifying a Boost library as a dependency does not propagate the necessary cxxflags
to that library during compilation. This results in binary incompatibilities and/or linker errors.
Howdy strangers.
Would you mind adding [email protected] to the stlab slack?
The CMake build is broken on multiple platforms for what seems to be several reasons.
Acceptance Criteria
Note that #93 could be used as a start for continuous integration support.
Here is my run of ./configure.sh
and ./build.sh
on MacOS 12.1
$ ./configure.sh
INFO : double-conversion found: skipping setup.
INFO : boost_libraries found: skipping setup.
INFO : No patchfile found for this version of Boost. Skipping.
INFO : b2 found: skipping boostrap.
...
INFO : You are ready to go!
$ ./build.sh
INFO : Make sure you run the configure script before this one to ensure dependencies are
in place.
ERRR : BUILDTOOL unknown. Goodbye.
./cmake_build_all.sh
made some progress but then failed with a missing boost include
/Users/ajafri/code/adobe_source_libraries/../boost_libraries/libs/type_i
ndex/include/boost/type_index/type_index_facade.hpp:13:10: fatal error:
'boost/container_hash/hash_fwd.hpp' file not found
#include <boost/container_hash/hash_fwd.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 7%] Building CXX object imported/double-conversion/CMakeFiles/double-
conversion.dir/double-conversion/fixed-dtoa.cc.o
1 error generated.
make[2]: *** [CMakeFiles/boost_unit_test.dir/Users/ajafri/code/boost_lib
raries/libs/test/src/debug.cpp.o] Error 1
make[1]: *** [CMakeFiles/boost_unit_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 7%] Building CXX object imported/double-conversion/CMakeFiles/double-
conversion.dir/double-conversion/string-to-double.cc.o
[ 8%] Building CXX object imported/double-conversion/CMakeFiles/double-
conversion.dir/double-conversion/strtod.cc.o
In file included from /Users/ajafri/code/boost_libraries/libs/filesystem
/src/exception.cpp:15:
/Users/ajafri/code/adobe_source_libraries/../boost_libraries/libs/filesy
stem/include/boost/filesystem/path.hpp:33:10: fatal error: 'boost/functi
onal/hash_fwd.hpp' file not found
#include <boost/functional/hash_fwd.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/boost_glob.dir/Users/ajafri/code/boost_librarie
s/libs/filesystem/src/exception.cpp.o] Error 1
make[1]: *** [CMakeFiles/boost_glob.dir/all] Error 2
[ 8%] Linking CXX static library libdouble-conversion.a
[ 8%] Built target double-conversion
make: *** [all] Error 2
This issue existed in the legacy/ repo and was not migrated here. Adobe Begin's Xcode project fails to link the binary when compiling in release mode. There are several unit test cases that exhibit the same linker error, and I have been able to work around them by turning off optimizations.
The stlab libraries are already a dependency to support the old copy_on_write which has migrated. We'll take a similar approach to the now migrated forest library, but this requires adding the dependency to the cmake build system for CI.
In CMakeLists.txt, target_link_boost function the correct target names for Boost libraries found by FindBoost()
are Boost::system, Boost::filesystem and Boost::thread.
The current values used ${Boost_XXX_LIBRARY} are not defined and as a result boost includes and libraries are not added to the compiler command line.
The code below does the same test with both forest and list. They should produce the same output, but they don't, because the forest copy constructor does not handle exceptions appropriately.
#include "adobe/forest.hpp"
#include <iostream>
#include <list>
bool activate = false;
class test {
public:
test(int d) : data_(d) { std::cout << "create " << data_ << std::endl; }
test(const test& o) : data_(o.data_) {
std::cout << "copy c " << data_ << std::endl;
if (activate && data_ == 2) {
std::cout << "throw " << data_ << std::endl;
throw 0;
}
}
test& operator=(const test& o) {
data_ = o.data_;
std::cout << "copy = " << data_ << std::endl;
return *this;
}
~test() { std::cout << "delete " << data_ << std::endl; }
private:
friend std::ostream& operator<<(std::ostream& out, const test& o);
int data_;
};
std::ostream& operator<<(std::ostream& out, const test& o) {
out << o.data_;
return out;
}
template<class T>
void x() try {
using forest = T;
forest f1;
f1.push_back(1);
f1.push_back(2);
f1.push_back(3);
activate = true;
forest f(f1);
} catch(...) { activate = false; }
int main() {
std::cout << "adobe::forest" << std::endl;
x<adobe::forest<test>>();
std::cout << "std::list" << std::endl;
x<std::list<test>>();
}
adobe::forest
create 1
copy c 1
delete 1
create 2
copy c 2
delete 2
create 3
copy c 3
delete 3
copy c 1 // never gets deleted below.
copy c 2
throw 2
delete 1
delete 2
delete 3
std::list
create 1
copy c 1
delete 1
create 2
copy c 2
delete 2
create 3
copy c 3
delete 3
copy c 1
copy c 2
throw 2
delete 1
delete 1
delete 2
delete 3
Work for this issue is taking place on the test_cleanup
branch.
A lot of older unit tests are no longer relevant given the most recent migration to c++11 and the removal of the ABI-safe library elements.
The current structures that have been removed are:
adobe::vector
adobe::string_t
adobe::type_info
adobe::move
There are unit tests that depended on these old sources that will have to be updated:
test/copy_on_write
test/any_iterator
test/closed_hash
test/move
test/poly
test/serialization
Good day all,
I was looking at adobe::poly and remember the Small Object Optimization post done by Sean Parent https://stlab.cc/tip/2017/12/23/small-object-optimizations.html
In reading the poly.hpp implementation it seem like it suffers from the same undefined behavior of casting the stored object to its base when the base was never stored.
When you do:
template
explicit poly_base(T x,
typename boost::disable_if<boost::is_base_of<poly_base, T>>::type* = 0) {
::new (storage()) implementation::poly_instance<Instance>(std::move(x));
}
You're storing a poly_instance, that will be a class derived from optimized_storage_type, derived from either poly_state_local or poly_state_remote, that finally derives from the interface.
Then when you do
interface_type& interface_ref() { return static_cast<interface_type>(storage()); }
We are just casting a typedef double storage_t[2]; to the interface class, when it was never stored there because a poly_instance was, granted the only ones that have data are poly_state_local and poly_state_remote, bu the interface is virtual and that is the first violation mention by Sean Parent
Did I missed something or understood the issue wrong, if so please ignore this and accept my apologies.
adobe::rotate calls overloaded rotate function template best suited for iterator type in hand through tag dispatch.
template <typename I> // I models Forward Iterator
std::pair<I, I> rotate(I f, I m, I l) {
typedef typename std::iterator_traits<I>::iterator_category iterator_category;
return rotate(f, m, l, iterator_category());
}
In rotate.hpp there is only one other rotate overload which is overloaded for bidirectional iterators.
Where is the std::forward_iterator_tag overload? I couldn't find it in included headers.
Acceptance Criteria
poly_regular.hpp
belongs in this library.The master branch used move_from but I am unable to find it in the source code. Is this an error or been replace?
adobe_source_libraries/adobe/poly_regular.hpp
Lines 63 to 67 in 5ced8bf
From sourceforge - issue 5. The expression "(c & 0x80) == 1" is always false. I believe you just want "(c & 0x80)". I would also change "std::isprint(c) == false" to !std::isprint(c).
https://github.com/stlab/adobe_source_libraries/blob/master/source/expression_filter.cpp#L525
https://github.com/stlab/adobe_source_libraries/blob/master/source/expression_filter.cpp#L549
I may well be missing something, but I am unable to build trunk. I am using Ubuntu Server 14.04.1 and clang version 4.0.0. clang++ is working fine.
Here's what I did:
svn co https://github.com/stlab/adobe_source_libraries.git
cd adobe_source_libraries.git/trunk
./configure.sh
This succeeds with:
INFO : You are ready to go!
./build.sh
ERRR : BUILDTOOL unknown. Goodbye.
I add BUILDTOOL=bjam to build.sh
Running ./build.sh now results in clang++ being unable to find any of the standard headers:
E.g.:
../boost_libraries/boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef' file not found
There are a number of boost classes which can now be migrated over to the standard.
boost::bind
-> std::bind
or lambdasboost::reference_wrapper
-> std::reference_wrapper
boost::any
-> std::any
boost::equality_comparable
and other concepts could be moved to their std
equivalentboost::mpl::xxx
have the potential to be migrated to similar constructs in std
boost::remove_reference/remove_const/is_reference/etc...
type traits could be migrated to their std
equivalentboost::is_pod/is_integral/etc...
have std
equivalentsboost::enable_if
and other similar metaprogramming templates could be moved to their std
equivalentsboost::begin/end/prev/next
have equivalents in std
boost::iteratorxxx
types/helpers could be investigated to see if they can be replaced with std
or range-based for loopsboost::mem_fn
-> std::mem_fn
boost::size
-> std::size
boost::range
related types and helpers could have equivalents in the standard based on the situationboost::posix_time
could potentially be migrated to std::chrono
boost::filesystem
-> std::filesystem
Hi,
I would be delighted to be added to the ASL slack group. My email address is:
Kind regards,
For your information,
On my setup (GCC 5.1 or Clang 3.5 Fedora Boost 1.57),
Expression "adobe::size(selection)" in line above does not compile because adobe::selection_t has no non-const begin/end and Boost concept check requires both versions.
I defined -DBOOST_RANGE_ENABLE_CONCEPT_ASSERT=0 to fix my build.
/usr/include/boost/range/concepts.hpp
BOOST_CONCEPT_USAGE(SinglePassRangeConcept)
{
// This has been modified from assigning to this->i
// (where i was a member variable) to improve
// compatibility with Boost.Lambda
iterator i1 = boost::begin(*m_range);
iterator i2 = boost::end(*m_range);
boost::ignore_unused_variable_warning(i1);
boost::ignore_unused_variable_warning(i2);
const_constraints(*m_range);
}
Is this a possibility for the future?
Hi,
could you add me to the ASL's Slack team?
I would like to add Windows support for the ASL and discuss/see, if some one else is already working on this, whom I could support in case?
Thanks and regards,
Felix
Hello, it looks like the readme is a little out of date for building, so I tried loading the vcxproj in the msvc_ide directory. It looks like there is a property sheet missing, because I get the error:
Microsoft Visual Studio
Unable to read the project file "adobe_source.vcxproj".
G:\asl\msvc_ide\boost_all.props(5,5): The imported project "G:\asl\msvc_ide\asl_client_config.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
OK
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.