weak Questions

3

Solved

I am passing some weakrefs from Python into C++ class, but C++ destructors are actively trying to access the ref when the real object is already dead, obviously it crashes... Is there any Python C...
Competent asked 7/6, 2010 at 21:43

1

Currently I encountered a weak link issue on Mac OS X 10.6.7 with Xcode 4.0.2. $ gcc --version i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) As the developer document s...
Thoughtful asked 15/5, 2011 at 15:28

4

During compiling this C code extern void Default_Handler(void); void NMI_Handler(void) __attribute__ ((weak, alias ("Default_Handler"))); I've recive this error: 'NMI_Handler' aliased to undef...
Concertgoer asked 7/2, 2018 at 9:29

0

I'm getting a weird gcc behaviour when dealing with weak const variables on different optimize levels (i.e. -O0 or -O1). Here is the code: def.h: declarations const int var; int copy; int do_copy(v...
Boll asked 22/12, 2020 at 16:6

4

Solved

For legacy reasons I need to use intrusive pointers, as I need the ability to convert raw pointers to smart pointers. However I noticed there is no weak intrusive pointer for boost. I did find a t...
Suzannasuzanne asked 8/3, 2010 at 9:59

3

Solved

I have the following piece of code: private final List<WeakReference<T>> slaves; public void updateOrdering() { // removes void weak references // and ensures that weak references...
Underprivileged asked 28/12, 2013 at 12:35

3

Solved

I always using [weak self] in swift closure to prevent reference cycle. Here is the code below, is it the correct way? someTask(completion: {[weak self] (result) in if self == nil { return } ...
Atomicity asked 16/2, 2019 at 2:5

2

Consider the simple program below: __attribute__((weak)) void weakf(void); int main(int argc, char *argv[]) { weakf(); } When compiling this with gcc and running it on a Linux PC, it segfaults...
Merari asked 3/7, 2015 at 9:33

1

Solved

I want to build a class TParent containing several child objects by using aggregation. Some of the objects are independant, while some can be also dependant on the other children. All the children ...
Cob asked 3/11, 2017 at 2:50

6

Solved

I'm using Swift 2 and using WeakContainer as a way to store a set of weak objects, much like NSHashTable.weakObjectsHashTable() struct WeakContainer<T: AnyObject> { weak var value: T? } pu...
Cholecystitis asked 27/9, 2015 at 12:34

2

If I have a closure in another closure is it enough to use unowned/weak once in the outer closure to avoid retain cycles? Example: foo.aClosure({[unowned self] (allowed: Bool) in if allowed { s...
Pavlodar asked 15/6, 2016 at 14:8

1

In GCC, If a variable is declared with weak attribute, and, in (static) linking time, no definition is found, the variable will have address zero, i.e., if a pointer is initialized with the address...
Unpretentious asked 23/11, 2016 at 4:54

4

Solved

This is used in the weakify pattern of Objective-C My guess is that it means: assign a weak reference to self with the name 'weakSelf' and the typeof self (e.g. MyViewController) If it's correct an...
Principe asked 19/5, 2014 at 16:18

1

Solved

What is the difference between passing [weak self] as an argument to a closure vs passing [weak self] () For example : dispatch_async(dispatch_get_main_queue()) { [weak self] in //Some code her...
Lilah asked 16/12, 2015 at 6:40

2

Solved

Let's say I have a some objects representing network connections. Once these connections are disconnected, the associated objects disappear. I don't want to hang on to a connection object which is ...
Layman asked 23/11, 2015 at 0:39

0

I am a little confused by something I am seeing in Xcode 7, the 3 colors below all have a separate address as you would expect, but the weak colors all have the same address. I understand that the ...
Acquittance asked 21/8, 2015 at 16:12

2

Solved

i want to make a weak pointer to self in swift like how we used to in objective-c like __weak Something *weakself = self; I have found people explaining how to use a 'weak self' inside a block,...
Angle asked 19/4, 2015 at 21:13

2

I got a problem dealing with soft and weak references. Code has a flag that switches all logic between soft and weak references. And while with weak references all seems to be working ok, with soft...
Adiaphorism asked 2/1, 2013 at 19:46

4

Solved

What is the proper way to add objects in NSMutableArray which is strongly defined by property. [tapBlockView setTapBlock:^(UIImage* image) { [self.myImageArray addObject:image]; // self retain cy...
Prue asked 6/11, 2012 at 18:47

1

Solved

As you read here in most cases a IBOutlet should be weak. Now as you can read in the development library not all classes support weak references. (e.g. NSTextView). This means you have to use assi...
Syrup asked 14/10, 2012 at 13:32

2

Solved

I'm trying to understand the way ARC works, and as far as I know, I should be doing something wrong here. This is the code I'm using: Interface: @interface ViewController : UIViewController{ } ...
Granddaddy asked 26/2, 2012 at 11:51

4

Solved

I am currently in a situation like: struct A { shared_ptr<B> b; }; struct B { shared_ptr<A> a; }; //... shared_ptr<A> a(new A()); shared_ptr<B> b(new B()); a->...
Almemar asked 26/8, 2010 at 16:31

5

There seem to be 3 ways of telling GCC to weak link a symbol: __attribute__((weak_import)) __attribute__((weak)) #pragma weak symbol_name None of these work for me: #pragma weak asdf extern vo...
Backbite asked 8/11, 2008 at 14:9
1

© 2022 - 2024 — McMap. All rights reserved.