instance of "Parameter" object destroyed immediately

Bug #812114 reported by Reijo Tomperi
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Johan Engelen

Bug Description

[../inkscape/inkscape/src/extension/param/parameter.h:85]: (error) instance of "Parameter" object destroyed immediately
(revision 10464)

You can't call a constructor from a constructor in C++ (well, you can, but it just creates a temporary object which is destroyed right after the call). See alternative methods to do the same thing from:
http://stackoverflow.com/questions/308276/c-call-constructor-from-constructor

Here is the problematic code:
                  Parameter (const gchar * name,
                              const gchar * guitext,
                              const gchar * desc,
                              const Parameter::_scope_t scope,
                              bool gui_hidden,
                              const gchar * gui_tip,
                              Inkscape::Extension::Extension * ext);
                  Parameter (const gchar * name,
                              const gchar * guitext,
                              Inkscape::Extension::Extension * ext) {
                      Parameter(name, guitext, NULL, Parameter::SCOPE_USER, false, NULL, ext); // <-- Problem here
                  };

Tags: cppcheck
su_v (suv-lp)
tags: added: cppcheck
Revision history for this message
Jon A. Cruz (jon-joncruz) wrote :

Most likely a confusion from Java, since ctors calling other ctors is the norm there.

su_v (suv-lp)
Changed in inkscape:
assignee: nobody → Jon A. Cruz (jon-joncruz)
status: New → Confirmed
Revision history for this message
Kris (kris-degussem) wrote :

Fixed in trunk revision 10699

Changed in inkscape:
assignee: Jon A. Cruz (jon-joncruz) → Johan Engelen (johanengelen)
status: Confirmed → Fix Committed
importance: Undecided → Medium
milestone: none → 0.49
Revision history for this message
Kris (kris-degussem) wrote :

Fix was committed in revision 10699 a few.

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.