GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A problem about zoom a image.

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
gtkguan
Familiar Face


Joined: 07 Jun 2008
Posts: 23
Location: Hangzhou, ZheJiang, China

PostPosted: Sat Sep 06, 2008 7:37 pm    Post subject: A problem about zoom a image. Reply with quote

How do I zoom a image in? What is the exhaustive steps?
In my program, I use gdk_pixbuf_new_from_file() and gtk_image_new_from_pixbuf() functions to display the image. Then get the new pixbuf that modified the width and the height by gdk_pixbuf_scale_simple() .
But when I run this program, I find that it expend the memory each zooming the image (including zoom in and zoom out).
I know my program has a lot of faults. I want the concrete steps that zooming a image.
Thank you!
Back to top
dreblen
Never Seen the Sunlight


Joined: 14 Jun 2007
Posts: 936
Location: Falun, WI USA

PostPosted: Sat Sep 06, 2008 11:13 pm    Post subject: Reply with quote

I don't really understand what your problem is (is memory not being freed?), but here's an example of gdk_pixbuf_scale_simple:
Code: (C)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include <gtk/gtk.h>

typedef struct _ImData
{
    GtkImage *im;
    GdkPixbuf *disp;
    GdkPixbuf *full;
    GtkRange *scale;
} ImData;

void file_set_cb(GtkFileChooser *fc, ImData *id)
{
    GError *err;
    gchar *filename;

    err = NULL;

    /* get a filename, if the action was canceled, filename will be == NULL */
   
filename = gtk_file_chooser_get_filename(fc);
    if(filename == NULL)
        return;

    /* reset the hscale and make sure that it's sensitive */
   
gtk_range_set_value(id->scale, 1);
    if(GTK_WIDGET_SENSITIVE(id->scale) == FALSE)
        gtk_widget_set_sensitive(GTK_WIDGET(id->scale), TRUE);

    /* if our full and disp != NULL, then free them since they're old */
   
if(id->full != NULL)
        g_free(id->full);
    if(id->disp != NULL)
        g_free(id->disp);

    /* get our fullsized pixbuf */
   
id->full = gdk_pixbuf_new_from_file(filename, &err);
    if(err != NULL)
    {
        g_warning(err->message);
        g_error_free(err);
        return;
    }

    /* right now, disp is the same as the fullsized pixbuf */
   
id->disp = id->full;

    /* update the image */
   
gtk_image_set_from_pixbuf(id->im, id->disp);
}

void value_changed_cb(GtkRange *range, ImData *id)
{
    gdouble scalef;
    gint w, h;

    /* if the pixbuf hasn't been initialized yet */
   
if(id->full == NULL)
        return;

    /* the scale factor is == the value of the hscale */
   
scalef = gtk_range_get_value(range);

    /* get the width and height ... */
   
w = gdk_pixbuf_get_width(id->full);
    h = gdk_pixbuf_get_height(id->full);

    /* ...now scale the width and height by the scale factor */
   
w *= scalef;
    h *= scalef;

    /* free our old disp pixbuf */
   
g_free(id->disp);
    /* now disp is == full scaled by scalef */
   
id->disp = gdk_pixbuf_scale_simple(id->full, w, h, GDK_INTERP_BILINEAR);
    /* update the image */
   
gtk_image_set_from_pixbuf(id->im, id->disp);
}

int main(int argc, char **argv)
{
    GtkWidget *win;
    GtkWidget *vbox;
    GtkWidget *button;
    GtkWidget *hscale;
    GtkWidget *swin;
    GtkWidget *im;

    ImData *id;

    id = g_slice_new(ImData);
    id->disp = id->full = NULL;

    gtk_init(&argc, &argv);

    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect(win, "delete-event", G_CALLBACK(gtk_main_quit), NULL);

    vbox = gtk_vbox_new(FALSE, 2);
    gtk_container_add(GTK_CONTAINER(win), vbox);
    gtk_widget_show(vbox);

    im = gtk_image_new();
    id->im = GTK_IMAGE(im);

    button = gtk_file_chooser_button_new("Select file", GTK_FILE_CHOOSER_ACTION_OPEN);
    g_signal_connect(button, "file-set", G_CALLBACK(file_set_cb), (gpointer)id);
    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
    gtk_widget_show(button);

    hscale = gtk_hscale_new_with_range(0.1, 2, 0.1);
    g_signal_connect(hscale, "value-changed", G_CALLBACK(value_changed_cb), (gpointer)id);
    gtk_range_set_value(GTK_RANGE(hscale), 1);
    gtk_box_pack_start(GTK_BOX(vbox), hscale, FALSE, FALSE, 0);
    gtk_widget_show(hscale);
    gtk_widget_set_sensitive(hscale, FALSE);
    id->scale = GTK_RANGE(hscale);

    swin = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_box_pack_start(GTK_BOX(vbox), swin, TRUE, TRUE, 0);
    gtk_widget_show(swin);

    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), im);
    gtk_widget_show(im);

    gtk_widget_show(win);

    gtk_main();

    return 0;
}
Back to top
gtkguan
Familiar Face


Joined: 07 Jun 2008
Posts: 23
Location: Hangzhou, ZheJiang, China

PostPosted: Tue Sep 09, 2008 10:51 pm    Post subject: Reply with quote

thanks!
But I think there is a defect in the upper example.(I run this program in MS windows xp. )
I opend a 1MB bitmap file and maximize the window. And every time I move the slider back and forth, the memory space occupied by this program is increasing all the time. At last
the value reaches to 330,000KB.I do not explain this phenomenon.
But when I minimize the window, the value declines to 3,120KB.


Last edited by gtkguan on Tue Sep 09, 2008 11:15 pm; edited 1 time in total
Back to top
dreblen
Never Seen the Sunlight


Joined: 14 Jun 2007
Posts: 936
Location: Falun, WI USA

PostPosted: Tue Sep 09, 2008 11:04 pm    Post subject: Reply with quote

thanks for pointing that out, I'll be looking into it as soon as I can...
Back to top
dreblen
Never Seen the Sunlight


Joined: 14 Jun 2007
Posts: 936
Location: Falun, WI USA

PostPosted: Wed Sep 10, 2008 12:40 am    Post subject: Reply with quote

okay, I've fixed the memory problems.
all that's changed is that i'm using gdk_pixbuf_copy instead of direct assignment,
and g_object_unref instead of g_free
Code: (C)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include <gtk/gtk.h>

typedef struct _ImData
{
    GtkImage *im;
    GdkPixbuf *disp;
    GdkPixbuf *full;
    GtkRange *scale;
} ImData;

void file_set_cb(GtkFileChooser *fc, ImData *id)
{
    GError *err;
    gchar *filename;

    err = NULL;

    /* get a filename, if the action was canceled, filename will be == NULL */
   
filename = gtk_file_chooser_get_filename(fc);
    if(filename == NULL)
        return;

    /* reset the hscale and make sure that it's sensitive */
   
gtk_range_set_value(id->scale, 1);
    if(GTK_WIDGET_SENSITIVE(id->scale) == FALSE)
        gtk_widget_set_sensitive(GTK_WIDGET(id->scale), TRUE);

    /* if our full and disp != NULL, then free them since they're old */
   
if(id->full != NULL)
        g_free(id->full);
    if(id->disp != NULL)
        g_free(id->disp);

    /* get our fullsized pixbuf */
   
id->full = gdk_pixbuf_new_from_file(filename, &err);
    if(err != NULL)
    {
        g_warning(err->message);
        g_error_free(err);
        return;
    }

    /* right now, disp is the same as the fullsized pixbuf */
   
id->disp = gdk_pixbuf_copy(id->full);

    /* update the image */
   
gtk_image_set_from_pixbuf(id->im, id->disp);
}

void value_changed_cb(GtkRange *range, ImData *id)
{
    gdouble scalef;
    gint w, h;

    /* if the pixbuf hasn't been initialized yet */
   
if(id->full == NULL)
        return;

    /* the scale factor is == the value of the hscale */
   
scalef = gtk_range_get_value(range);

    /* get the width and height ... */
   
w = gdk_pixbuf_get_width(id->full);
    h = gdk_pixbuf_get_height(id->full);

    /* ...now scale the width and height by the scale factor */
   
w *= scalef;
    h *= scalef;

    /* free our old disp pixbuf */
   
g_object_unref(id->disp);
    /* now disp is == full scaled by scalef */
   
id->disp = gdk_pixbuf_scale_simple(id->full, w, h, GDK_INTERP_BILINEAR);
    /* update the image */
   
gtk_image_set_from_pixbuf(id->im, id->disp);
}

int main(int argc, char **argv)
{
    GtkWidget *win;
    GtkWidget *vbox;
    GtkWidget *button;
    GtkWidget *hscale;
    GtkWidget *swin;
    GtkWidget *im;

    ImData *id;

    id = g_slice_new(ImData);
    id->disp = id->full = NULL;

    gtk_init(&argc, &argv);

    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect(win, "delete-event", G_CALLBACK(gtk_main_quit), NULL);

    vbox = gtk_vbox_new(FALSE, 2);
    gtk_container_add(GTK_CONTAINER(win), vbox);
    gtk_widget_show(vbox);

    im = gtk_image_new();
    id->im = GTK_IMAGE(im);

    button = gtk_file_chooser_button_new("Select file", GTK_FILE_CHOOSER_ACTION_OPEN);
    g_signal_connect(button, "file-set", G_CALLBACK(file_set_cb), (gpointer)id);
    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
    gtk_widget_show(button);

    hscale = gtk_hscale_new_with_range(0.1, 2, 0.1);
    g_signal_connect(hscale, "value-changed", G_CALLBACK(value_changed_cb), (gpointer)id);
    gtk_range_set_value(GTK_RANGE(hscale), 1);
    gtk_box_pack_start(GTK_BOX(vbox), hscale, FALSE, FALSE, 0);
    gtk_widget_show(hscale);
    gtk_widget_set_sensitive(hscale, FALSE);
    id->scale = GTK_RANGE(hscale);

    swin = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_box_pack_start(GTK_BOX(vbox), swin, TRUE, TRUE, 0);
    gtk_widget_show(swin);

    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), im);
    gtk_widget_show(im);

    gtk_widget_show(win);

    gtk_main();

    return 0;
}
Back to top
ramesh
GTK+ Guru


Joined: 16 Nov 2006
Posts: 270
Location: INDIA

PostPosted: Wed Sep 10, 2008 4:56 am    Post subject: Reply with quote

dreblen wrote:
okay, I've fixed the memory problems.
all that's changed is that i'm using gdk_pixbuf_copy instead of direct assignment,
and g_object_unref instead of g_free
Code: (C)
1
/* last example code */



hi
same memory problem accuring
Quote:

*** glibc detected *** ./zoom_image: double free or corruption (out): 0x09234cb8 ***
======= Backtrace: =========
/lib/libc.so.6[0x4da874]
/lib/libc.so.6(cfree+0x96)[0x4dc8d6]
/lib/libglib-2.0.so.0(g_free+0x36)[0x1b7396]
./zoom_image[0x8048ee3]
/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__VOID+0x84)[0x1458b4]
.....
Back to top
dreblen
Never Seen the Sunlight


Joined: 14 Jun 2007
Posts: 936
Location: Falun, WI USA

PostPosted: Thu Sep 11, 2008 9:16 pm    Post subject: Reply with quote

can you post your steps to reproduce?
I'm not getting a double free on my ubuntu system or my vista system.
are you using the latest version of the example?
Back to top
virgoptrex@yahoo.com
Familiar Face


Joined: 03 Feb 2010
Posts: 21

PostPosted: Mon Feb 08, 2010 6:31 pm    Post subject: Reply with quote

dreblen wrote:
can you post your steps to reproduce?
I'm not getting a double free on my ubuntu system or my vista system.
are you using the latest version of the example?


Ok I am having same problem as the above poster too on ubuntu 8.10

Code: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

gtk_tutorial$ ./testzoom
*** glibc detected *** ./testzoom: munmap_chunk(): invalid pointer: 0x096d57a0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb777d454]
/usr/local/lib/libglib-2.0.so.0(g_free+0x31)[0xb78ad8c1]
./testzoom[0x80490a9]
/usr/local/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__VOID+0x4f)[0xb7959f3f]
/usr/local/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0xb794cc89]
/usr/local/lib/libgobject-2.0.so.0[0xb79611e9]
/usr/local/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x896)[0xb7962de6]
/usr/local/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7963129]
/usr/lib/libgtk-x11-2.0.so.0[0xb7dfd8b9]
/usr/local/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__VOID+0x4f)[0xb7959f3f]
/usr/local/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0xb794cc89]
/usr/local/lib/libgobject-2.0.so.0[0xb79611e9]
/usr/local/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x896)[0xb7962de6]
/usr/local/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7963129]
/usr/lib/libgtk-x11-2.0.so.0(gtk_adjustment_value_changed+0x8a)[0xb7cfb0ca]
/usr/lib/libgtk-x11-2.0.so.0[0xb7dff773]
/usr/lib/libgtk-x11-2.0.so.0[0xb7dc2cbb]
/usr/local/lib/libgobject-2.0.so.0[0xb794b5a9]
/usr/local/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0xb794cc89]
/usr/local/lib/libgobject-2.0.so.0[0xb7961374]
/usr/local/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x5d4)[0xb7962b24]
/usr/local/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7963129]
/usr/lib/libgtk-x11-2.0.so.0[0xb7dfdb89]
/usr/lib/libgtk-x11-2.0.so.0[0xb7dffe21]
/usr/lib/libgtk-x11-2.0.so.0[0xb7dc3036]
/usr/local/lib/libgobject-2.0.so.0[0xb794b5a9]
/usr/local/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0xb794cc89]
/usr/local/lib/libgobject-2.0.so.0[0xb7961374]
/usr/local/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x5d4)[0xb7962b24]
/usr/local/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7963129]
/usr/lib/libgtk-x11-2.0.so.0[0xb7ed833e]
/usr/lib/libgtk-x11-2.0.so.0(gtk_propagate_event+0xec)[0xb7dbbb4c]
/usr/lib/libgtk-x11-2.0.so.0(gtk_main_do_event+0x2e7)[0xb7dbcef7]
/usr/lib/libgdk-x11-2.0.so.0[0xb7c5350a]
/usr/local/lib/libglib-2.0.so.0(g_main_context_dispatch+0x178)[0xb78a5808]
/usr/local/lib/libglib-2.0.so.0[0xb78a8c87]
/usr/local/lib/libglib-2.0.so.0(g_main_loop_run+0x1e7)[0xb78a8fb7]
/usr/lib/libgtk-x11-2.0.so.0(gtk_main+0xb9)[0xb7dbd3a9]
./testzoom[0x8049430]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7724685]
./testzoom[0x8048ea1]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 07:00 294416     /home/virgoptrex/Desktop/gtk_tutorial/testzoom
0804a000-0804b000 rw-p 00001000 07:00 294416     /home/virgoptrex/Desktop/gtk_tutorial/testzoom
094dc000-09774000 rw-p 094dc000 00:00 0          [heap]
b6e96000-b6ea3000 r-xp 00000000 07:00 1591732    /lib/libgcc_s.so.1
b6ea3000-b6ea4000 r--p 0000c000 07:00 1591732    /lib/libgcc_s.so.1
b6ea4000-b6ea5000 rw-p 0000d000 07:00 1591732    /lib/libgcc_s.so.1
b6ea5000-b6f05000 rw-s 00000000 00:09 2949146    /SYSV00000000 (deleted)
b6f05000-b6f37000 rw-p b6f05000 00:00 0
b6f37000-b6fc0000 r--p 00000000 07:00 1405040    /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
b6fc0000-b6fcf000 r-xp 00000000 07:00 1591238    /lib/libbz2.so.1.0.4
b6fcf000-b6fd0000 r--p 0000f000 07:00 1591238    /lib/libbz2.so.1.0.4
b6fd0000-b6fd1000 rw-p 00010000 07:00 1591238    /lib/libbz2.so.1.0.4
b6fd1000-b7106000 r-xp 00000000 07:00 1282647    /usr/lib/libxml2.so.2.6.32
b7106000-b7107000 ---p 00135000 07:00 1282647    /usr/lib/libxml2.so.2.6.32
b7107000-b710b000 r--p 00135000 07:00 1282647    /usr/lib/libxml2.so.2.6.32
b710b000-b710c000 rw-p 00139000 07:00 1282647    /usr/lib/libxml2.so.2.6.32
b710c000-b710d000 rw-p b710c000 00:00 0
b710d000-b713e000 r-xp 00000000 07:00 1282871    /usr/lib/libcroco-0.6.so.3.0.1
b713e000-b7141000 rw-p 00030000 07:00 1282871    /usr/lib/libcroco-0.6.so.3.0.1
b7141000-b7171000 r-xp 00000000 07:00 1283148    /usr/lib/libgsf-1.so.114.0.8
b7171000-b7173000 r--p 0002f000 07:00 1283148    /usr/lib/libgsf-1.so.114.0.8
b7173000-b7174000 rw-p 00031000 07:00 1283148    /usr/lib/libgsf-1.so.114.0.8
b7174000-b7175000 rw-p b7174000 00:00 0
b7175000-b71a6000 r-xp 00000000 07:00 1283510    /usr/lib/librsvg-2.so.2.22.3
b71a6000-b71a7000 r--p 00030000 07:00 1283510    /usr/lib/librsvg-2.so.2.22.3
b71a7000-b71a8000 rw-p 00031000 07:00 1283510    /usr/lib/librsvg-2.so.2.22.3
b71b9000-b71ba000 r-xp 00000000 07:00 1314201    /usr/lib/gtk-2.0/2.10.0/loaders/svg_loader.so
b71ba000-b71bb000 r--p 00000000 07:00 1314201    /usr/lib/gtk-2.0/2.10.0/loaders/svg_loader.so
b71bb000-b71bc000 rw-p 00001000 07:00 1314201    /usr/lib/gtk-2.0/2.10.0/loaders/svg_loader.so
b71bc000-b721c000 rw-s 00000000 00:09 2916377    /SYSV00000000 (deleted)
b721c000-b721e000 r-xp 00000000 07:00 1478307    /usr/local/lib/pango/1.6.0/modules/pango-basic-fc.so
b721e000-b721f000 rw-p 00001000 07:00 1478307    /usr/local/lib/pango/1.6.0/modules/pango-basic-fc.so
b721f000-b72b4000 r--p 00000000 07:00 1405041    /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
b72b4000-b72ba000 r--s 00000000 07:00 1078128    /var/cache/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-x86.cache-2
b72ba000-b72bd000 r--s 00000000 07:00 1078122    /var/cache/fontconfig/e383d7ea5fbe662a33d9b44caf393297-x86.cache-2
b72bd000-b72be000 r--s 00000000 07:00 1078121    /var/cache/fontconfig/4c73fe0c47614734b17d736dbde7580a-x86.cache-2
b72be000-b72c1000 r--s 00000000 07:00 1077214    /var/cache/fontconfig/a755afe4a08bf5b97852ceb7400b47bc-x86.cache-2
b72c1000-b72c4000 r--s 00000000 07:00 1078124    /var/cache/fontconfig/6d41288fd70b0be22e8c3a91e032eec0-x86.cache-2
b72c4000-b72c7000 r--s 00000000 07:00 1078120    /var/cache/fontconfig/de156ccd2eddbdc19d37a45b8b2aac9c-x86.cache-2
b72c7000-b72cf000 r--s 00000000 07:00 1078123    /var/cache/fontconfig/e3de0de479f42330eadf588a55fb5bf4-x86.cache-2
b72cf000-b72da000 r--s 00000000 07:00 1078119    /var/cache/fontconfig/0f34bcd4b6ee430af32735b75db7f02b-x86.cache-2
b72da000-b72db000 r--s 00000000 07:00 1077275    /var/cache/fontconfig/4794a0821666d79190d59a36cb4f44b5-x86.cache-2
b72db000-b72de000 r--s 00000000 07:00 1078127    /var/cache/fontconfig/de9486f0b47a4d768a594cb4198cb1c6-x86.cache-2
b72de000-b72e2000 r-xp 00000000 07:00 1314193    /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so
b72e2000-b72e3000 r--p 00003000 07:00 1314193    /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so
b72e3000-b72e4000 rw-p 00004000 07:00 1314193    /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so
b72e4000-b72fb000 r--s 00000000 07:00 1362859    /usr/share/mime/mime.cache
b72fb000-b7331000 r-xp 00000000 07:00 1591484    /lib/libdbus-1.so.3.4.0
b7331000-b7332000 r--p 00035000 07:00 1591484    /lib/libdbus-1.so.3.4.0
b7332000-b7333000 rw-p 00036000 07:00 1591484    /lib/libdbus-1.so.3.4.0
b7333000-b734e000 r-xp 00000000 07:00 1282900    /usr/lib/libdbus-glib-1.so.2.1.0
b734e000-b734f000 r--p 0001a000 07:00 1282900    /usr/lib/libdbus-glib-1.so.2.1.0
b734f000-b7350000 rw-p 0001b000 07:00 1282900    /usr/lib/libdbus-glib-1.so.2.1.0
b7350000-b7358000 r-xp 00000000 07:00 1282885    /usr/lib/libtrackerclient.so.0.0.0
b7358000-b7359000 r--p 00007000 07:00 1282885    /usr/lib/libtrackerclient.so.0.0.0
b7359000-b735a000 rw-p 00008000 07:00 1282885    /usr/lib/libtrackerclient.so.0.0.0
b735a000-b7379000 r-xp 00000000 07:00 1314161    /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so
b7379000-b737a000 r--p 0001e000 07:00 1314161    /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so
b737a000-b737b000 rw-p 0001f000 07:00 1314161    /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so
b737b000-b7385000 r-xp 00000000 07:00 1610006    /lib/tls/i686/cmov/libnss_files-2.8.90.so
b7385000-b7386000 r--p 00009000 07:00 1610006    /lib/tls/i686/cmov/libnss_files-2.8.90.so
b7386000-b7387000 rw-p 0000a000 07:00 1610006    /lib/tls/i686/cmov/libnss_files-2.8.90.so
b7387000-b7390000 r-xp 00000000 07:00 1610008    /lib/tls/i686/cmov/libnss_nis-2.8.90.so
b7390000-b7391000 r--p 00008000 07:00 1610008    /lib/tls/i686/cmov/libnss_nis-2.8.90.so
b7391000-b7392000 rw-p 00009000 07:00 1610008    /lib/tls/i686/cmov/libnss_nis-2.8.90.so
b7392000-b73a7000 r-xp 00000000 07:00 1610003    /lib/tls/i686/cmov/libnsl-2.8.90.so
b73a7000-b73a8000 r--p 00014000 07:00 1610003    /lib/tls/i686/cmov/libnsl-2.8.90.so
b73a8000-b73a9000 rw-p 00015000 07:00 1610003    /lib/tls/i686/cmov/libnsl-2.8.90.so
b73a9000-b73ab000 rw-p b73a9000 00:00 0
b73ab000-b73b2000 r-xp 00000000 07:00 1610004    /lib/tls/i686/cmov/libnss_compat-2.8.90.so
b73b2000-b73b3000 r--p 00006000 07:00 1610004    /lib/tls/i686/cmov/libAborted

Back to top
tadeboro
Never Seen the Sunlight


Joined: 23 Jul 2008
Posts: 2114
Location: Slovenia

PostPosted: Mon Feb 08, 2010 7:44 pm    Post subject: Reply with quote

Hi.

Those segfaults are probably caused by lines 30 and 32. g_free() on those lines should be replaced by g_object_unref().

Tadej
Back to top
virgoptrex@yahoo.com
Familiar Face


Joined: 03 Feb 2010
Posts: 21

PostPosted: Mon Feb 08, 2010 8:44 pm    Post subject: Reply with quote

tadeboro wrote:
Hi.

Those segfaults are probably caused by lines 30 and 32. g_free() on those lines should be replaced by g_object_unref().

Tadej


Thanks for the reply. However, the problem still persist after changes!
Back to top
tadeboro
Never Seen the Sunlight


Joined: 23 Jul 2008
Posts: 2114
Location: Slovenia

PostPosted: Mon Feb 08, 2010 9:09 pm    Post subject: Reply with quote

Hi.

What steps do you need to take to make this application segfault?

Tadej
Back to top
virgoptrex@yahoo.com
Familiar Face


Joined: 03 Feb 2010
Posts: 21

PostPosted: Tue Feb 09, 2010 1:59 am    Post subject: Reply with quote

tadeboro wrote:
Hi.

What steps do you need to take to make this application segfault?

Tadej


I changed the lines to
Code: (Plaintext)
1
2
3
4
5
6

   if(id->full != NULL)
       g_object_unref(id->full);
    if(id->disp != NULL)
      g_object_unref(id->disp);


I have a make file to compile the above code
Code: (Plaintext)
1
2
3
4
5
6
7
8
9

filename = testzoom
sample: $(filename).c
    gcc -g -Wall `pkg-config --cflags --libs gtk+-2.0` $(filename).c -o $(filename)
   
clean:
    @echo Removing generated files...
    rm -rf $(filename).o $(filename)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP