[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: Florian Schröder
Subject: Re: [Linphone-developers] Crash on new config using C-API
Date: Tue, 26 Apr 2016 15:08:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

Hello Leland,

I agree, it is sensible to provide defaults and this is why I used the function lp_config_new_with_factory in the first place where I put the general defaults in the factory settings file. My environment is rather static.

What I find curios is the timing of the crash. After the code snipped I gave is executed, the configuration file is on disk. Still on the first incoming call the program crashes. Doing the same with a file present beforehand, even empty, is working perfectly fine.

My solution will be to touch the config file before calling  lp_config_new_with_factory.

Tanks a lot

On 26.04.2016 14:22, Leland Green wrote:
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

Linphone-developers mailing list

Dipl.-Inform. Florian Schröder

SmartWireless GmbH & Co. KG
Robert-Perthel-Straße 45 | 50739 Köln | Germany
Tel.: +49 221 5349 772 | | address@hidden
Amtsgericht Wuppertal HRA 23796 | USt-ID: DE292644908 | Geschäftsführer: Guido Meis, Arno Redicker
Persönlich haftende Gesellschafterin: SmartWireless Beteiligungs-GmbH | Amtsgericht Wuppertal HRB25321

Der Inhalt dieser E-Mail ist ausschließlich für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie, dass jede Form der Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des Inhalts dieser E-Mail unzulässig ist. Wir bitten Sie, sich in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen.

reply via email to

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