Boost C++ Libraries: Ticket #2782: boost::program_options::notify crashes when variables_map contains user inserted values https://svn.boost.org/trac10/ticket/2782 <p> variables_map is useful as a generic properties map (esp. due to its various parsers). But when variables_map contains user inserted values (a properties map would support adding/setting values. variables_map does allow base std::map::insert being called), notify would crash/segfault/die due to m_value_semantic being null (empty shared_ptr). </p> <p> I suggest that a simple check be added to the notify function before calling (*it).second.m_value_semantic-&gt;notify() </p> <p> This would make it a lot more convenient for those who build a properties wrapper around program_options. Thanks. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2782 Trac 1.4.3 anonymous Fri, 20 Feb 2009 09:28:16 GMT component changed; owner set https://svn.boost.org/trac10/ticket/2782#comment:1 https://svn.boost.org/trac10/ticket/2782#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Vladimir Prus</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">program_options</span> </li> </ul> Ticket Vladimir Prus Fri, 20 Feb 2009 09:30:51 GMT <link>https://svn.boost.org/trac10/ticket/2782#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2782#comment:2</guid> <description> <p> Why are you calling 'notify' *after* adding your own values? I am not saying this is wrong, just trying to understand your use case. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 20 Feb 2009 10:02:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2782#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2782#comment:3</guid> <description> <p> Here is a use case that arises from modular multi-component options processing: a variables_map is passed to the init functions of components, where their options are parsed. Sometimes, I want to set some property values after parsing in one component and then the variables_map is passed to another component for further processing with its own set options. This currently doesn't work due to the notify crash. </p> <p> My current workaround is don't call notify ever and missing out 2 nice features (setting a variable via typed_value and of course notifier itself.) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Sat, 30 May 2009 10:26:55 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2782#comment:4 https://svn.boost.org/trac10/ticket/2782#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/53440" title="Make 'notify' ignore values without associated semantics. Fixes #2782. ">[53440]</a>) Make 'notify' ignore values without associated semantics. </p> <p> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2782" title="#2782: Bugs: boost::program_options::notify crashes when variables_map contains ... (closed: fixed)">#2782</a>. </p> Ticket