Having a quick peek at the code, probably
 
    SPDocument *doc = SP_ACTIVE_DOCUMENT;
 
would fix it. I do not understand how the code works at this moment :S
sp_document_repr_doc(doc) is a macro and expands to  "doc->rdoc"...
 
Regards,
Johan



From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of Jon A. Cruz
Sent: woensdag 4 april 2007 9:52
To: Inkscape Devel List
Subject: Re: [Inkscape-devel] Warning in gradient-selector.cpp


On Apr 3, 2007, at 11:47 PM, Bob Jamison wrote:

src/widgets/gradient-selector.cpp, line 302:


static void

sp_gradient_selector_add_vector_clicked (GtkWidget *w, 

SPGradientSelector *sel)

{

    SPDocument *doc;

    SPGradient *gr;

    Inkscape::XML::Node *repr;



All other issues aside, this is one of the points where I *really* push for not leaving uninitialized variables.

sp_gradient_selector_add_vector_clicked (GtkWidget *w,
SPGradientSelector *sel)
{
    SPDocument *doc = 0;
    SPGradient *gr = 0;
    Inkscape::XML::Node *repr = 0;


Of course, that would cause things to crash each and every time that code is hit, but that's better than getting random effects and crashes later on. Pushes us to get it fixed right, too.

This case it doesn't quite address Bob's immediate question, but it is a good chance to ask people to keep an eye out and fix uninitialized things as they go near them.