Commit 54727a8e authored by Claes Sjofors's avatar Claes Sjofors

valgrind check modifications

parent d0182d42
......@@ -501,6 +501,7 @@ void XttGtk::activate_india_ok( GtkWidget *w, gpointer data)
g_object_set( ((XttGtk *)xtt)->india_widget, "visible", FALSE, NULL);
(xtt->india_ok_cb)( xtt, text);
g_free( text);
}
void XttGtk::activate_india_cancel( GtkWidget *w, gpointer data)
{
......@@ -549,6 +550,7 @@ void XttGtk::valchanged_cmd_input( GtkWidget *w, gpointer data)
xtt->command_open = 0;
xtt->xnav->set_inputfocus();
}
g_free( text);
}
int main( int argc, char *argv[])
......
......@@ -143,6 +143,8 @@ static int flow_create_gc( FlowDrawGtk *draw_ctx, GdkWindow *window)
GdkGCValues xgcv;
int i;
memset( &xgcv, 0, sizeof(xgcv));
/* Inverse gc */
xgcv.background = draw_ctx->foreground;
xgcv.foreground = draw_ctx->background;
......
......@@ -341,7 +341,8 @@ void FlowArray::remove( FlowArrayElem *element)
{
if ( *(a + i) == element)
{
memcpy( a+i, a+i+1, (a_size-i-1)*sizeof(*a));
if ( a_size - i - 1 > 0)
memcpy( a+i, a+i+1, (a_size-i-1)*sizeof(*a));
a_size--;
return;
}
......
......@@ -92,11 +92,27 @@ FlowCtx::FlowCtx( const char *ctx_name, double zoom_fact, int offs_x, int offs_y
FlowCtx::~FlowCtx()
{
FlowArrayElem *element;
delete tiptext;
set_nodraw();
a_sel.clear();
move_clear();
paste_clear();
delete_all();
for ( int i = 0; i < a_nc.a_size; i++) {
element = a_nc.a[i];
a_nc.remove( element);
delete element;
i--;
}
for ( int i = 0; i < a_cc.a_size; i++) {
element = a_cc.a[i];
a_cc.remove( element);
delete element;
i--;
}
}
void FlowCtx::delete_all()
......
......@@ -84,6 +84,8 @@ FlowNode::~FlowNode()
{
if ( annotv_inputmode[i])
close_annotation_input( i);
if ( annotsize[i] > 0)
free( annotv[i]);
}
ctx->object_deleted( this);
if ( ctx->nodraw) return;
......
......@@ -156,7 +156,8 @@ Graph::Graph(
border_color(1), fill_color(1), fill(0), border(1), shadow(0),
grid_size_x(1), grid_size_y(1), con_type(glow_eConType_Routed),
con_corner(glow_eCorner_Rounded),
conpoint_direction(glow_eDirection_Center),
conpoint_direction(glow_eDirection_Center),
current_polyline(0), current_slider(0),
trace_started(0), gdh_init_done(xn_gdh_init_done), arglist_cnt(0),
corner_round_amount(0.5), mode(graph_mode), scan_time(0.5),
fast_scan_time(0.5), animation_scan_time(0.5), closing_down(0),
......@@ -4782,6 +4783,7 @@ void Graph::swap( int mode)
static void graph_free_dyn( grow_tObject object)
{
if ( grow_GetObjectType( object) == glow_eObjectType_GrowNode ||
grow_GetObjectType( object) == glow_eObjectType_GrowSlider ||
grow_GetObjectType( object) == glow_eObjectType_GrowGroup ||
grow_GetObjectType( object) == glow_eObjectType_GrowWindow ||
grow_GetObjectType( object) == glow_eObjectType_GrowTrend ||
......
......@@ -281,6 +281,8 @@ static int glow_create_gc( GlowDrawGtk *draw_ctx, GdkWindow *window)
draw_sColor *color_array, *color_p;
int size, sts;
memset( &xgcv, 0, sizeof(xgcv));
/* Inverse gc */
xgcv.background = glow_allocate_named_color( draw_ctx, "black");
xgcv.foreground = draw_ctx->background;
......@@ -3184,6 +3186,7 @@ int GlowDrawGtk::gradient_fill_rect( GlowWind *wind, int x, int y, int w, int h,
if ( ww->clip_on)
reset_cairo_clip( ww, cr);
cairo_pattern_destroy(pat);
cairo_destroy(cr);
}
return 1;
......@@ -3238,6 +3241,7 @@ int GlowDrawGtk::gradient_fill_rectrounded( GlowWind *wind, int x, int y, int w,
if ( ww->clip_on)
reset_cairo_clip( ww, cr);
cairo_pattern_destroy(pat);
cairo_destroy(cr);
}
return 1;
......@@ -3292,6 +3296,7 @@ int GlowDrawGtk::gradient_fill_arc( GlowWind *wind, int x, int y, int w, int h,
if ( ww->clip_on)
reset_cairo_clip( ww, cr);
cairo_pattern_destroy(pat);
cairo_destroy(cr);
}
return 1;
......@@ -3348,6 +3353,7 @@ int GlowDrawGtk::gradient_fill_polyline( GlowWind *wind, glow_sPointX *points, i
if ( ww->clip_on)
reset_cairo_clip( ww, cr);
cairo_pattern_destroy(pat);
cairo_destroy(cr);
}
......
......@@ -653,7 +653,8 @@ void GlowArray::remove( GlowArrayElem *element)
{
if ( *(a + i) == element)
{
memcpy( a+i, a+i+1, (a_size-i-1)*sizeof(*a));
if ( a_size - i - 1 > 0)
memcpy( a+i, a+i+1, (a_size-i-1)*sizeof(*a));
a_size--;
return;
}
......
......@@ -84,6 +84,10 @@ GrowNode::~GrowNode()
if ( hot)
ctx->gdraw->set_cursor( &ctx->mw, glow_eDrawCursor_Normal);
// delete nc;
for ( int i = 0; i < 10; i++) {
if ( annotsize[i] > 0)
free( annotv[i]);
}
}
void GrowNode::copy_from( const GrowNode& n)
......
......@@ -78,9 +78,10 @@ GrowTrend::GrowTrend( GrowCtx *glow_ctx, const char *name, double x, double y,
GrowTrend::~GrowTrend()
{
if ( ctx->nodraw) return;
erase( &ctx->mw);
erase( &ctx->navw);
if ( !ctx->nodraw) {
erase( &ctx->mw);
erase( &ctx->navw);
}
for ( int i = 0; i < curve_cnt; i++)
delete curve[i];
}
......
......@@ -118,6 +118,8 @@ void GlowPolyLine::open( ifstream& fp)
if ( end_found)
break;
}
if ( points)
free((char *)points);
points = (glow_sPointX *) calloc( a_points.a_size, sizeof(glow_sPointX));
}
......
......@@ -236,6 +236,11 @@ RtTraceGtk::~RtTraceGtk()
/* Destroy the widgets */
if ( toplevel)
gtk_widget_destroy( toplevel);
if ( wow)
delete wow;
if ( trace_timerid)
delete trace_timerid;
}
void RtTraceGtk::pop()
......
......@@ -1525,7 +1525,7 @@ RtTrace::RtTrace( void *tr_parent_ctx, pwr_tObjid tr_objid,
trace_con_cc(0), trace_started(0), trace_timerid(0), trace_changenode(0),
objid(pwr_cNObjid), scan_time(0.5), close_cb(0), help_cb(0), subwindow_cb(0),
display_object_cb(0), collect_insert_cb(0), is_authorized_cb(0), popup_menu_cb(0),
call_method_cb(0), trace_list(0), version(0), m_has_host(0)
call_method_cb(0), trace_list(0), version(0), m_has_host(0), wow(0)
{
}
#endif
......@@ -2620,6 +2620,7 @@ static int xnav_open_func( void *client_data,
else {
if ( classgraph) {
// Get file from class of instance object
pwr_tAttrRef aref;
pwr_tCid cid;
if ( !instance_p) {
......@@ -2633,6 +2634,12 @@ static int xnav_open_func( void *client_data,
return XNAV__HOLDCOMMAND;
}
sts = gdh_NameToAttrref( pwr_cNObjid, instance_p, &aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttrRefTid( &aref, &cid);
if ( EVEN(sts)) return sts;
switch ( cid) {
case pwr_cClass_NMpsCell:
case pwr_cClass_NMpsStoreCell:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment