how come these code give me memory leaks



Could someone please tell how why these codes give me memory leaks.

//this class is a child of Gtk::Button

   std::string display_text = "some\ntext";

  lb = new Gtk::Label();

   lb->set_markup(g_markup_printf_escaped("<span font='10.2' font_family='%s'>%s</span>",FONT_FAMILY,u_space_to_newline(display_text,number_of_spaces).c_str()));

   if(number_of_spaces>3)
   {
       lb->set_markup(g_markup_printf_escaped("<span font='9.3' font_family='%s'>%s</span>",FONT_FAMILY,u_space_to_newline(display_text).c_str()));
   }
   lb->set_use_markup();
   lb->modify_fg(Gtk::STATE_NORMAL,Gdk::Color(fg_color));
   lb->modify_fg(Gtk::STATE_PRELIGHT,Gdk::Color(fg_color));
   lb->show();

   this->remove();
   this->add(*lb);


   lb->set_line_wrap(true);
   lb->set_justify(Gtk::JUSTIFY_CENTER);
   this->modify_bg(Gtk::STATE_NORMAL,Gdk::Color(bg_color));
      this->fg_color = fg_color;this->modify_bg(Gtk::STATE_PRELIGHT,Gdk::Color(bg_color));
      this->fg_color = fg_color;this->modify_bg(Gtk::STATE_ACTIVE,Gdk::Color(SELECTED_COLOR));


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