Skip to content

Commit

Permalink
Fix debug_form and trace_form
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed May 5, 2024
1 parent 3bb60dc commit 8b74cc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/xtd.forms/include/xtd/forms/debug_form.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace xtd {
xtd::diagnostics::debug::listeners().push_back(listener_);
#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
visible(true);
defined = true;
#endif
}
/// @}
Expand All @@ -66,14 +67,12 @@ namespace xtd {
void flush() override;

void write(const xtd::ustring& debug) override {
#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
if (!defined) return;
trace_form_base::write(debug);
#endif
}
void write_line(const xtd::ustring& debug) override {
#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
if (!defined) return;
trace_form_base::write_line(debug);
#endif
}
/// @}

Expand All @@ -90,6 +89,7 @@ namespace xtd {

private:
std::shared_ptr<xtd::diagnostics::trace_listener> listener_ = xtd::forms::control_trace_listener::create(*this);
bool defined = false;
};
}
}
8 changes: 4 additions & 4 deletions src/xtd.forms/include/xtd/forms/trace_form.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace xtd {
xtd::diagnostics::trace::listeners().push_back(listener_);
#if defined(TRACE)
visible(true);
defined = true;
#endif
}
/// @}
Expand All @@ -64,14 +65,12 @@ namespace xtd {

/// @{
void write(const xtd::ustring& trace) override {
#if defined(TRACE)
if (!defined) return;
trace_form_base::write(trace);
#endif
}
void write_line(const xtd::ustring& trace) override {
#if defined(TRACE)
if (!defined) return;
trace_form_base::write_line(trace);
#endif
}

void flush() override;
Expand All @@ -90,6 +89,7 @@ namespace xtd {

private:
std::shared_ptr<xtd::diagnostics::trace_listener> listener_ = xtd::forms::control_trace_listener::create(*this);
bool defined = false;
};
}
}

0 comments on commit 8b74cc0

Please sign in to comment.