diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc
index cc8bcdf7b9984635ef8e58b6069c123f7fbe8668..195660a3340296fbad4e55cf04c90b5ffef8a707 100644
--- a/source/blender/windowmanager/intern/wm_operators.cc
+++ b/source/blender/windowmanager/intern/wm_operators.cc
@@ -1856,8 +1856,6 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *op, const wmEvent *eve
   }
 
   static SearchPopupInit_Data data{};
-  char temp_buffer[256] = "";
-  STRNCPY(temp_buffer, g_search_text);
 
   if (search_type == SEARCH_TYPE_SINGLE_MENU) {
     {
@@ -1871,6 +1869,9 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *op, const wmEvent *eve
       MEM_SAFE_FREE(buffer);
     }
   }
+  else {
+    g_search_text[0] = '\0';
+  }
 
   data.search_type = search_type;
   data.size[0] = UI_searchbox_size_x() * 2;
@@ -1878,10 +1879,6 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *op, const wmEvent *eve
 
   UI_popup_block_invoke_ex(C, wm_block_search_menu, &data, nullptr, false);
 
-  /* g_search_text contains pressed letter here, copy previous searched
-   * value back to it, this will retain last searched result. see: #112896 */
-  STRNCPY(g_search_text, temp_buffer);
-
   return OPERATOR_INTERFACE;
 }