Page 1 of 1

Lunettes - compile issue and crash (fixed - what now?)

Posted: 16 Dec 2010 04:26
by Technologicat
I'm not sure if this is the right forum to post this, but this is not exactly libVLC development or 1.1.x...

I was testing Lunettes today. I checked out HEAD from git at https://github.com/pdherbemont/Glasses.

On OS X 10.6.5 / Xcode 3.2.5, Lunettes no longer compiles out of the box. I got three of these errors from VLCSplashScreenWindowController.m:

error: when default property synthesis is on, 'availableMediaDiscoverer' lookup will access property ivar instead of global variable [-Wnonfragile-abi2]

Well, that's exceptionally clear for a compiler error. Since the availableMediaDiscoverer accessor clearly looks like a singleton that wants to access the global, I fixed this in my copy by renaming the global and the references to it in the accessor to resolve the name conflict. After this change the app compiled correctly.

Should I create a ticket? A patch? Something?

Second issue - I ran into this crash bug: http://trac.videolan.org/vlc/ticket/3707

Fortunately, I was running in the debugger, so I found the immediate cause. It seems some items have no description (str == nil), so the loop crashes on a null pointer dereference. I added a check for this in my copy, and this particular crash went away. See the ticket for details.

Re: Lunettes - compile issue and crash (fixed - what now?)

Posted: 30 Dec 2010 21:59
by Technologicat
Since the availableMediaDiscoverer accessor clearly looks like a singleton that wants to access the global, I fixed this in my copy by renaming the global and the references to it in the accessor to resolve the name conflict. After this change the app compiled correctly.
I suppose I could have been more specific in case a non-programmer runs into this issue.

Open VLCSplashScreenVideoController.m. Near the beginning, look for the line

Code: Select all

static NSMutableArray * availableMediaDiscoverer = nil; // Global list of media discoverers
Change it to

Code: Select all

static NSMutableArray * gavailableMediaDiscoverer = nil; // Global list of media discoverers
(just adding the "g").

Then, find this accessor (a bit less than halfway through the file):

Code: Select all

- (NSArray *)availableMediaDiscoverer { if( !availableMediaDiscoverer ) { availableMediaDiscoverer = [[NSArray arrayWithObjects: [[[VLCMediaDiscoverer alloc] initWithName:@"sap"] autorelease], [[[VLCMediaDiscoverer alloc] initWithName:@"upnp_intel"] autorelease], [[[VLCMediaDiscoverer alloc] initWithName:@"freebox"] autorelease], [[[VLCDVDDiscoverer alloc] init] autorelease],nil] retain]; } return availableMediaDiscoverer; }
Change it to

Code: Select all

- (NSArray *)availableMediaDiscoverer { if( !gavailableMediaDiscoverer ) { gavailableMediaDiscoverer = [[NSArray arrayWithObjects: [[[VLCMediaDiscoverer alloc] initWithName:@"sap"] autorelease], [[[VLCMediaDiscoverer alloc] initWithName:@"upnp_intel"] autorelease], [[[VLCMediaDiscoverer alloc] initWithName:@"freebox"] autorelease], [[[VLCDVDDiscoverer alloc] init] autorelease],nil] retain]; } return gavailableMediaDiscoverer; }
(adding the three "g"s).

This fixes the compile issue.

Then, make the change documented in http://trac.videolan.org/vlc/ticket/3707, and both issues should be fixed.