GTK+ 3.0 C++ The same code works/crashes, depending on situation -
i got problem gtk. there function programclose()
can called multiple ways:
// file->quit g_signal_connect(g_object(quit), "activate", g_callback(programclose), &data); // user closed app clicking reddish x mark on title bar g_signal_connect(g_object(window), "delete-event", g_callback(programclose), &data);
programclose()
looks that:
void programclose(gtkmenuitem *quit, filedata *data) { if(data->issaved != true) { showsavefiledialog(null, data); } }
and in showsavefiledialog()
:
void showsavefiledialog(gtkmenuitem *savefile, filedata *data) { cout << data->somebool; // ok cout << data->somestring; // crashes here }
i tried making function closing app clicking x, did not help:
void programclose(gtkwindow *window, filedata *data)
any sugestions?
edit:
lol, forgot mention fine when user closes app clicking file->quit, programme crashes when clicking reddish x mark
ok fixed myself. problem forgot callback functions signatures. created wrapper function closing programme clicking reddish x:
void programclosebyx(gtkwindow *window, gdkevent *event, filedata *data) { programclose(null, data); }
c++ gtk
No comments:
Post a Comment