mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 20:56:39 +00:00 
			
		
		
		
	Merge branch 'fix_ui_coverity' into 'master'
Fix Coverity uninitialized variables See merge request OpenMW/openmw!1408
This commit is contained in:
		
						commit
						a37066c9f0
					
				
					 7 changed files with 24 additions and 9 deletions
				
			
		|  | @ -3,10 +3,13 @@ | |||
| 
 | ||||
| namespace LuaUi | ||||
| { | ||||
|     LuaText::LuaText() | ||||
|         : mAutoSized(true) | ||||
|     {} | ||||
| 
 | ||||
|     void LuaText::initialize() | ||||
|     { | ||||
|         WidgetExtension::initialize(); | ||||
|         mAutoSized = true; | ||||
|     } | ||||
| 
 | ||||
|     bool LuaText::setPropertyRaw(std::string_view name, sol::object value) | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ namespace LuaUi | |||
|         MYGUI_RTTI_DERIVED(LuaText) | ||||
| 
 | ||||
|         public: | ||||
|             LuaText(); | ||||
|             virtual void initialize() override; | ||||
| 
 | ||||
|         private: | ||||
|  |  | |||
|  | @ -11,8 +11,8 @@ namespace LuaUi | |||
|     { | ||||
|         MYGUI_RTTI_DERIVED(LuaTextEdit) | ||||
| 
 | ||||
|     protected: | ||||
|         bool setPropertyRaw(std::string_view name, sol::object value) override; | ||||
|         protected: | ||||
|             bool setPropertyRaw(std::string_view name, sol::object value) override; | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,6 +8,13 @@ | |||
| 
 | ||||
| namespace LuaUi | ||||
| { | ||||
|     WidgetExtension::WidgetExtension() | ||||
|         : mForcedCoord() | ||||
|         , mAbsoluteCoord() | ||||
|         , mRelativeCoord() | ||||
|         , mAnchor() | ||||
|     {} | ||||
| 
 | ||||
|     void WidgetExtension::triggerEvent(std::string_view name, const sol::object& argument = sol::nil) const | ||||
|     { | ||||
|         auto it = mCallbacks.find(name); | ||||
|  | @ -27,11 +34,6 @@ namespace LuaUi | |||
| 
 | ||||
|     void WidgetExtension::initialize() | ||||
|     { | ||||
|         mAbsoluteCoord = MyGUI::IntCoord(); | ||||
|         mRelativeCoord = MyGUI::FloatCoord(); | ||||
|         mAnchor = MyGUI::FloatSize(); | ||||
|         mForcedCoord = MyGUI::IntCoord(); | ||||
| 
 | ||||
|         // \todo might be more efficient to only register these if there are Lua callbacks
 | ||||
|         mWidget->eventKeyButtonPressed += MyGUI::newDelegate(this, &WidgetExtension::keyPress); | ||||
|         mWidget->eventKeyButtonReleased += MyGUI::newDelegate(this, &WidgetExtension::keyRelease); | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ namespace LuaUi | |||
|     class WidgetExtension | ||||
|     { | ||||
|     public: | ||||
|         WidgetExtension(); | ||||
|         // must be called after creating the underlying MyGUI::Widget
 | ||||
|         void create(lua_State* lua, MyGUI::Widget* self); | ||||
|         // must be called after before destroying the underlying MyGUI::Widget
 | ||||
|  | @ -42,7 +43,6 @@ namespace LuaUi | |||
|         void updateCoord(); | ||||
| 
 | ||||
|     protected: | ||||
|         ~WidgetExtension() {} | ||||
|         sol::table makeTable() const; | ||||
|         sol::object keyEvent(MyGUI::KeyCode) const; | ||||
|         sol::object mouseEvent(int left, int top, MyGUI::MouseButton button) const; | ||||
|  |  | |||
|  | @ -4,6 +4,12 @@ | |||
| 
 | ||||
| namespace LuaUi | ||||
| { | ||||
|     LuaWindow::LuaWindow() | ||||
|         : mCaption() | ||||
|         , mPreviousMouse() | ||||
|         , mChangeScale() | ||||
|     {} | ||||
| 
 | ||||
|     void LuaWindow::initialize() | ||||
|     { | ||||
|         WidgetExtension::initialize(); | ||||
|  |  | |||
|  | @ -13,6 +13,9 @@ namespace LuaUi | |||
|     { | ||||
|         MYGUI_RTTI_DERIVED(LuaWindow) | ||||
| 
 | ||||
|         public: | ||||
|             LuaWindow(); | ||||
| 
 | ||||
|         private: | ||||
|             // \todo replace with LuaText when skins are properly implemented
 | ||||
|             MyGUI::TextBox* mCaption; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue