Add IdleRegister to deal with destruction while idle func is queued

This adds a little helper class to `guiutils.*` that unregisters
in-flight idle functions queued by `IdleRegister::add()`. It's best
to call `IdleRegister::destroy()` in the destructor of the class
owning the `IdleRegister` instance. Otherwise make sure, it is the
last member which will be deleted first.

`Resize` now makes use of this new facility in `setDimensions()`, which
also fixes #3673.
This commit is contained in:
Flössie
2017-02-09 20:25:58 +01:00
parent 281982f329
commit 824ecaed41
4 changed files with 155 additions and 78 deletions

View File

@@ -25,25 +25,13 @@
#include "toolpanel.h"
#include "guiutils.h"
class Resize : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::SizeListener
class Resize final :
public ToolParamBlock,
public AdjusterListener,
public FoldableToolPanel,
public rtengine::SizeListener
{
protected:
Adjuster* scale;
Gtk::VBox* sizeBox;
MyComboBoxText* appliesTo;
MyComboBoxText* method;
MyComboBoxText* spec;
MySpinButton* w;
MySpinButton* h;
int maxw, maxh;
int cropw, croph;
sigc::connection sconn, aconn, wconn, hconn;
bool wDirty, hDirty;
ToolParamBlock* packBox;
public:
Resize ();
~Resize ();
@@ -75,6 +63,20 @@ private:
int getComputedHeight ();
void notifyBBox ();
void updateGUI ();
Adjuster* scale;
Gtk::VBox* sizeBox;
MyComboBoxText* appliesTo;
MyComboBoxText* method;
MyComboBoxText* spec;
MySpinButton* w;
MySpinButton* h;
int maxw, maxh;
int cropw, croph;
sigc::connection sconn, aconn, wconn, hconn;
bool wDirty, hDirty;
ToolParamBlock* packBox;
IdleRegister idle_register;
};
#endif