|
|
I apologize that I don't know how to descript it in short, so let's begin with a working example:
#include <FL/Fl.H>
#inlucde <FL/Fl_Window.H>
class App
{
public:
App(int w, int h, const char *title)
{
this->m_win = new Fl_window(w, h, title);
this->m_win->show();
}
~App()
{
if (this->m_win)
{
delete this->m_win;
this->m_win = nullptr;
}
}
private:
Fl_Window *m_win;
};
int main()
{
App app(400, 300, "APP");
return Fl::run();
}
The above snippet works properly and show an empty window when it runs, but when I turned it into PIMPL (see below), the window flashes and main returns 0 almost immediately:
In app.h file:
class AppImpl;
class App
{
public:
App(int w, int h, const char *title);
~App();
private:
AppImpl *m_impl;
};
In app.cpp file:
#include "app.h"
class AppImpl
{
public:
AppImpl(int w, int h, const char *title)
{
this->m_win = new Fl_window(w, h, title);
this->m_win->show();
}
~AppImpl()
{
if (this->m_win)
{
delete this->m_win;
this->m_win = nullptr;
}
}
private:
Fl_Window *m_win;
};
int main()
{
App app(400, 300, "APP");
return Fl::run();
}
Therefore the problem is, how to make the PIMPL code work? I've read the multithreading part of the documentation, but I'm not sure if my code is related.
Any help is much appreciated.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
[ Direct Link to Message ] | |
|
| |