slacknate
2016-06-14 13:07:31 UTC
Hi all,
It has been a while since i have posted here, but I have a question about
the FOX widget tree destruction. My understanding is that when FXApp is
torn down/is deleted/goes out of scope it will also tear down all
accessible parts of the widget tree. Example:
#include <signal.h>
#include "fx/fx.h"
#include "mainwindow.h"
int main(int argc, char *argv[]) {
FXApp app("App Name", "Vendor Name");
app.init(argc, argv);
MainWindow *window = new MainWindow(&app);
app.addSignal(SIGINT, window, MainWindow::ID_QUIT);
app.create();
window->show(PLACEMENT_CURSOR);
window->setFocus();
return app.run(); // when run completes app goes out of scope and the
widget tree is destroyed
}
Now it seems, quite reasonably so, that FXMenuCommands would be part of
this process. However, when when I create an FXMenuCommand in main window
and do not explicitly delete it myself in the main window destructor, the
app segfaults in FXAccelTable::removeAccel. MainWindow constructor:
MainWindow::MainWindow(FXApp *app) :
FXMainWindow(app, "App Name", nullptr, nullptr, DECOR_ALL, 0, 0, 1024, 768)
{
FXMenuBar *menu_bar = new FXMenuBar(this, this,
FRAME_RAISED|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
FXMenuPane *menu = new FXMenuPane(this);
new FXMenuCommand(menu, "Menu Entry\tCtrl-M\tMenu Entry.", 0, this,
ID_DUT);
new FXMenuTitle(menu_bar, "&Menu", 0, menu);
}
So my question is: are FXMenuCommands supposed to be manually deleted or is
this an actual issue?
It has been a while since i have posted here, but I have a question about
the FOX widget tree destruction. My understanding is that when FXApp is
torn down/is deleted/goes out of scope it will also tear down all
accessible parts of the widget tree. Example:
#include <signal.h>
#include "fx/fx.h"
#include "mainwindow.h"
int main(int argc, char *argv[]) {
FXApp app("App Name", "Vendor Name");
app.init(argc, argv);
MainWindow *window = new MainWindow(&app);
app.addSignal(SIGINT, window, MainWindow::ID_QUIT);
app.create();
window->show(PLACEMENT_CURSOR);
window->setFocus();
return app.run(); // when run completes app goes out of scope and the
widget tree is destroyed
}
Now it seems, quite reasonably so, that FXMenuCommands would be part of
this process. However, when when I create an FXMenuCommand in main window
and do not explicitly delete it myself in the main window destructor, the
app segfaults in FXAccelTable::removeAccel. MainWindow constructor:
MainWindow::MainWindow(FXApp *app) :
FXMainWindow(app, "App Name", nullptr, nullptr, DECOR_ALL, 0, 0, 1024, 768)
{
FXMenuBar *menu_bar = new FXMenuBar(this, this,
FRAME_RAISED|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
FXMenuPane *menu = new FXMenuPane(this);
new FXMenuCommand(menu, "Menu Entry\tCtrl-M\tMenu Entry.", 0, this,
ID_DUT);
new FXMenuTitle(menu_bar, "&Menu", 0, menu);
}
So my question is: are FXMenuCommands supposed to be manually deleted or is
this an actual issue?