Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debug|Refactor|UI|Client: Investigating issue when deleting widgets
Added GuiWidgetPrivate<> template to act as the base class for GUI widgets' private implementations. However, it appears that the widgets are not being deinitialized properly under certain circumstances...
- Loading branch information
Showing
28 changed files
with
216 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#ifndef DENG_CLIENT_GUIWIDGETPRIVATE_H | ||
#define DENG_CLIENT_GUIWIDGETPRIVATE_H | ||
|
||
#include <de/libdeng2.h> | ||
#include "guirootwidget.h" | ||
|
||
/** | ||
* Base class for GuiWidget-derived widgets' private implementation. Provides | ||
* easy access to the root widget and shared GL resources. This should be used | ||
* as the base class for private implementations if GL resources are being | ||
* used (i.e., glInit() and glDeinit() are being called). | ||
* | ||
* The destructor of classes derived from GuiWidgetPrivate must make the | ||
* following call: <pre>self.deserialize()</pre> | ||
* | ||
* Use DENG_GUI_PIMPL() instead of the DENG2_PIMPL() macro. | ||
*/ | ||
template <typename PublicType> | ||
class GuiWidgetPrivate : public de::Private<PublicType> | ||
{ | ||
public: | ||
typedef GuiWidgetPrivate<PublicType> Base; // shadows de::Private<>::Base | ||
|
||
public: | ||
GuiWidgetPrivate(PublicType &i) : de::Private<PublicType>(i) {} | ||
|
||
GuiWidgetPrivate(PublicType *i) : de::Private<PublicType>(i) {} | ||
|
||
virtual ~GuiWidgetPrivate() | ||
{ | ||
/** | ||
* Ensure that the derived's class's glDeinit() method has been | ||
* called before the private class instance is destroyed. At least | ||
* classes that have GuiWidget as the immediate parent class need to | ||
* call deinitialize() in their destructors. | ||
*/ | ||
DENG2_ASSERT(!self.isInitialized()); | ||
} | ||
|
||
bool hasRoot() const | ||
{ | ||
return self.hasRoot(); | ||
} | ||
|
||
GuiRootWidget &root() const | ||
{ | ||
DENG2_ASSERT(hasRoot()); | ||
return self.root(); | ||
} | ||
|
||
de::AtlasTexture &atlas() const | ||
{ | ||
return root().atlas(); | ||
} | ||
|
||
de::GLUniform &uAtlas() const | ||
{ | ||
return root().uAtlas(); | ||
} | ||
|
||
de::GLShaderBank &shaders() const | ||
{ | ||
return root().shaders(); | ||
} | ||
}; | ||
|
||
#define DENG_GUI_PIMPL(ClassName) \ | ||
typedef ClassName Public; \ | ||
struct ClassName::Instance : public GuiWidgetPrivate<ClassName> | ||
|
||
#endif // DENG_CLIENT_GUIWIDGETPRIVATE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.