[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-developers] Crash on new config using C-API

From: Leland Green
Subject: Re: [Linphone-developers] Crash on new config using C-API
Date: Tue, 26 Apr 2016 07:22:59 -0500

Hi Florian,

On the contrary, I would argue that it is common practice for programs to create a default config file if one does not exist. Linphone does it (at least on Linux, and I think it's similar on all platforms).

So if it was me, I would simply check if the config file exists, and if it doesn't, create the file before your code that is failing. You can either create a separate method for default settings, or just provide default values when you're reading them in. Even though it's a little more work up-front, I always prefer the former. It just seems much easier to maintain, and also your reading is separated from your writing, so you could provide other defaults via your program code (based on options in use).

A lot more than you asked, but I hope this answers at least how I feel about the question. 😎

 The Glow-In-The-Dark Man  custom styles in place... products coming soon in 2016!

On Tue, Apr 26, 2016 at 3:46 AM, Florian Schröder <address@hidden> wrote:
Hi everyone,

I stumble over a strange behavior when creating a config and receiving a
call. This snipped is part of my initialization using the C-API:

  static const char *config_path{"lp.conf"};
  static const char *defaults_path{"lp.default.conf"};
  auto config = lp_config_new_with_factory(config_path, defaults_path);

  vtable.call_state_changed = call_state_changed;
  vtable.text_received = text_received;

  lc = linphone_core_new_with_config(&vtable, config, &userdata);


When I start the program and lp.conf is not present, it aborts with the
error message 'double free or corruption' as soon as a call is incoming
(I auto accept all calls). When lp.conf is present, even if it is just
an empty file, everything is perfectly fine. The file is writable, even
if the program crashes, the lp.conf is written to file.

I can circumvent this by creating the file upfront, but I guess the
behavior is not right.

So my question is, should this work when lp.conf is not present or does
lp_config_new_with_factory assume to always receive existing file paths.

Thanks a lot

P.S.: OpenSUSE (Tumbleweed), gcc 5.3.1 (using c++14), linphone 3.9.1
(from repo)

Linphone-developers mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]